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

Update element.attributes getter steps to be less vague #1297

Closed
wants to merge 1 commit into from

Conversation

lukewarlow
Copy link
Member

@lukewarlow lukewarlow commented Jul 19, 2024

The getter steps were previously quite vague simply referring to "the associated NamedNodeMap" rather than referencing the attribute list concept.

  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: …
    • Gecko: …
    • WebKit: …
    • Deno (only for aborting and events): …
    • Node.js (only for aborting and events): …
  • MDN issue is filed: …
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

@annevk
Copy link
Member

annevk commented Aug 13, 2024

I agree that it's a bit vague and can be better, but this is incorrect. A node's attribute list is a list, not a NamedNodeMap.

@lukewarlow
Copy link
Member Author

https://dom.spec.whatwg.org/#concept-element-attribute

Elements also have an attribute list, which is a list exposed through a NamedNodeMap. Unless explicitly given when an element is created, its attribute list is empty.

I thought the exposed through a NamedNodeMap bit was enough? Or does the getter steps need to explicitly specify how to do that?

@lukewarlow
Copy link
Member Author

Hmm looking a bit more https://dom.spec.whatwg.org/#namednodemap it seems that the NamedNodeMap has an associated element, not the other way around as the getter is currently defined. But yeah it seems exposing the list directly is wrong.

There doesn't seem to be a spec way to make a namednode map from an attribute list? Would return this's attribute list as a NamedNodeMap work? Or does it need to be more precise? It's at least a little bit clearer than currently?

@annevk
Copy link
Member

annevk commented Aug 13, 2024

To make it explicit you would define an element's associated attribute object (a NamedNodeMap) and then return that when appropriate.

@lukewarlow
Copy link
Member Author

I'm gonna close this as I don't think it's going to be particularly clearer after any change I make

@lukewarlow lukewarlow closed this Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants