This repository has been archived by the owner on Nov 11, 2019. It is now read-only.
forked from whatwg/dom
-
Notifications
You must be signed in to change notification settings - Fork 18
DOMTokenList.add/remove normalize dupes/whitespace even if they're no-ops, but .toggle doesn't #118
Comments
@annevk? I hit this because it complicates testing -- if force-toggle worked the same as add/remove, we could reuse add/remove tests for force-toggle for free. |
Wrong repository again? Happy to make this change if you could copy the issue over, especially as you have tests. |
seems it's a bug. will test it in different UAs. |
yongsheng
pushed a commit
to yongsheng/dom
that referenced
this issue
May 17, 2017
1. Define token set using ordered set for DOMTokenList. 2. Refine DOMTokenList's length and indexing. 3. Make DOMTokenList's contains() not throw because it doesn't modify token set. 4. Combine DOMSettableTokenList into DOMTokenList, because DOMTokenList.value could be a stringifier attribute, therefore it is OK to make 'value' a stringifier. 5. Use less loops for DOMTokenList's add() and remove(). 6. Always update a DOMTokenList when invoking toggle(). This shall normalize duplicates and whitespaces even if they're no-ops like add()/remove(). This fixes w3c#118 too. 7. Introduce DOMTokenList's replace(). This shall fix w3c#117 together. 8. Introduce DOMTokenList's supports().
yongsheng
pushed a commit
that referenced
this issue
May 17, 2017
1. Define token set using ordered set for DOMTokenList. 2. Refine DOMTokenList's length and indexing. 3. Make DOMTokenList's contains() not throw because it doesn't modify token set. 4. Combine DOMSettableTokenList into DOMTokenList, because DOMTokenList.value could be a stringifier attribute, therefore it is OK to make 'value' a stringifier. 5. Use less loops for DOMTokenList's add() and remove(). 6. Always update a DOMTokenList when invoking toggle(). This shall normalize duplicates and whitespaces even if they're no-ops like add()/remove(). This fixes #118 too. 7. Introduce DOMTokenList's replace(). This shall fix #117 together. 8. Introduce DOMTokenList's supports().
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Per the current spec, this outputs "a b c c d d":
This is not consistent. If we want add/remove to normalize even if they're no-ops, so should toggle. This is especially true because force-toggle is otherwise precisely identical AFAICT, and the slight difference is confusing.
replace also doesn't normalize if the token doesn't exist, but that doesn't bother me as much since it doesn't otherwise behave identically to add/remove.
The text was updated successfully, but these errors were encountered: