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

"When a DOMTokenList object is created, then: ..." #666

Closed
TRowbotham opened this issue Jul 16, 2018 · 3 comments
Closed

"When a DOMTokenList object is created, then: ..." #666

TRowbotham opened this issue Jul 16, 2018 · 3 comments
Labels
good first issue Ideal for someone new to a WHATWG standard or software project

Comments

@TRowbotham
Copy link
Contributor

https://dom.spec.whatwg.org/commit-snapshots/32efc48fef28c34ed914b60cfb3c29807e617365/#interface-domtokenlist

When a DOMTokenList object is created, then:​

1. Let element be associated element\.

2. Let localName be associated attribute’s local name\.

3. Let value be the result of getting an attribute given null, localName, and element\.

4. Run the attribute change steps for element, localName, value, value, and null\. 

In step 3, "getting an attribute" links to the get an attribute by namespace and local name algorithm, which returns an Attr node or null. This is a problem because in step 4, value is passed to the "attribute change steps" as the oldValue and value arguments, which only accept a string or null. So, step 3 should either link to the get an attribute value algorithm or operate on the returned Attr node's value. Not really sure which is more appropriate here.

@annevk annevk added the good first issue Ideal for someone new to a WHATWG standard or software project label Jul 25, 2018
@annevk
Copy link
Member

annevk commented Jul 25, 2018

Making it use "get an attribute value" seems best. Might also be good to quickly look at blame to see if this regressed somehow or was always incorrect.

@TRowbotham
Copy link
Contributor Author

Looks like this this was first added by you in 4b291d1#diff-a467e681501e456ce8c1ef31425e1b41R9223

@TRowbotham
Copy link
Contributor Author

I had to read it a few times, but I *think* the steps prior to the above change were correct, but a bit more convoluted. It basically reads if the element has an attribute that is its associated attribute's local name, or if the element's associated attribute's local name is set, then set the list of tokens to the new value after being parsed by the ordered set parsing steps.

TRowbotham added a commit to TRowbotham/dom that referenced this issue Jul 25, 2018
This makes it so that if the `DOMTokenList`'s associated element has an attribute that is the associated attribute's local name, at creation time, it will use the "get an attribute value" steps, which will always return a string. Previously, the this used the "get an attribute by namespace and local name" steps, whuch would return an `Attr` node if the associated element had an attribute that is the associated attribute's local name. Fixes whatwg#666.
TRowbotham added a commit to TRowbotham/dom that referenced this issue Aug 1, 2018
This makes it so that if the `DOMTokenList`'s associated element has an attribute that is the associated attribute's local name, at creation time, it will use the "get an attribute value" steps, which will always return a string. Previously, the this used the "get an attribute by namespace and local name" steps, whuch would return an `Attr` node if the associated element had an attribute that is the associated attribute's local name. Fixes whatwg#666.
annevk pushed a commit that referenced this issue Aug 8, 2018
This makes it so that if a DOMTokenList's associated element has an attribute that is the associated attribute's local name, at creation time, it will use the "get an attribute value" steps, which will always return a string. Previously, the this used the "get an attribute by namespace and local name" steps, which would return an Attr node if the associated element had an attribute that is the associated attribute's local name.

Fixes #666.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Ideal for someone new to a WHATWG standard or software project
Development

No branches or pull requests

2 participants