html5ever icon indicating copy to clipboard operation
html5ever copied to clipboard

Creating attribute not recognized by local_name!()

Open kornelski opened this issue 5 years ago • 5 comments

  1. html5ever v0.22.5 is unaware of the decoding attribute: https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-decoding

  2. QualName::new(None, ns!(), local_name!("decoding")) doesn't recognize the name. Is there another way to create the attribute?

kornelski avatar Mar 20 '19 12:03 kornelski

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>.

SimonSapin avatar Mar 20 '19 13:03 SimonSapin

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.

federicomenaquintero avatar Jan 10 '20 15:01 federicomenaquintero

I'm inclined to say no, but I'll defer to @SimonSapin here.

jdm avatar Jan 10 '20 15:01 jdm

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.

SimonSapin avatar Jan 10 '20 18:01 SimonSapin

"download", "translate", "spellcheck", and "reversed" are other HTML content attributes missing from the list.

pshaughn avatar Jan 28 '20 15:01 pshaughn