Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating attribute not recognized by local_name!() #369

Open
kornelski opened this issue Mar 20, 2019 · 7 comments
Open

Creating attribute not recognized by local_name!() #369

kornelski opened this issue Mar 20, 2019 · 7 comments

Comments

@kornelski
Copy link
Contributor

  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?

@SimonSapin
Copy link
Member

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

@federicomenaquintero
Copy link
Contributor

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.

@jdm
Copy link
Member

jdm commented Jan 10, 2020

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

@SimonSapin
Copy link
Member

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.

@pshaughn
Copy link
Contributor

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

pshaughn added a commit to pshaughn/html5ever that referenced this issue Jan 28, 2020
bors-servo pushed a commit that referenced this issue Jan 28, 2020
Add local names mentioned in #369

Most of these are for HTML elements; "parse" is for xinclude, which at least one SVG library uses as explained in #369 (comment)
@noahbald
Copy link

I've also found vector-effect to be missing from the list

@jdm
Copy link
Member

jdm commented Oct 14, 2024

PRs to add additional items are accepted. Keep in mind that you can use LocalName::from_str in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants