html5ever
html5ever copied to clipboard
Creating attribute not recognized by local_name!()
-
html5ever v0.22.5 is unaware of the
decoding
attribute: https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-decoding -
QualName::new(None, ns!(), local_name!("decoding"))
doesn't recognize the name. Is there another way to create the attribute?
If an attribute name is mentioned in the HTML spec, it should probably be added to the set of statically-known strings for LocalName
so that it can be used with the local_name!
macro.
LocalName
implements From<&str>
.
Should the statically-known strings include non-HTML attribute names? For librsvg I need the parse
attribute from xinclude. I've been using things like this:
let attr: QualName = ...;
match attr.expanded() {
expanded_name!("", "href") => ...,
expanded_name!("", encoding") => ...,
ref v if *v == ExpandedName { ns: &ns!(), local: &LocalName::from("parse") } => ...,
}
I can submit a PR for those missing names if they are in markup5ever's scope.
I'm inclined to say no, but I'll defer to @SimonSapin here.
I think any name that can commonly appear in a DOM attribute name or element name on web content should be fine to add, especially if it’s defined in a W3C or WHATWG spec. In this specific case, Servo will likely want to implement SVG eventually.
"download", "translate", "spellcheck", and "reversed" are other HTML content attributes missing from the list.