Skip to content

variable number of tokens for .add() and .remove()#37

Open
w8r wants to merge 1 commit into
remy:masterfrom
w8r:classlist-token-fix
Open

variable number of tokens for .add() and .remove()#37
w8r wants to merge 1 commit into
remy:masterfrom
w8r:classlist-token-fix

Conversation

@w8r

@w8r w8r commented Sep 11, 2014

Copy link
Copy Markdown

No description provided.

@jerone

jerone commented Sep 11, 2014

Copy link
Copy Markdown

MDN isn't clear about this (pages haven't been documented), but do toggle and contains support variable number of tokes too?

A comment on https://developer.mozilla.org/en-US/docs/Web/API/Element.classList looks like toggle supports it:

Versions of Firefox before 26 do not implement the use of several arguments in the add/remove/toggle methods. See https://bugzilla.mozilla.org/show_bug.cgi?id=814014

@w8r

w8r commented Sep 11, 2014

Copy link
Copy Markdown
Author

There's W3C on this: http://www.w3.org/TR/dom/#interface-domtokenlist. Which is as well not consistent, but it makes sense this way and is supported by at least Chrome and FF

@w8r

w8r commented Sep 11, 2014

Copy link
Copy Markdown
Author

According to that spec no, .contains() and .toggle() both take only one argument

@w8r

w8r commented Sep 11, 2014

Copy link
Copy Markdown
Author

However, the problem does not end here, IE10+ supports DOMTokenList, but unlike the others(as always), these methods take one argument only, so I came up with this. Should work for FF<26 as well in that case

@remy

remy commented Dec 27, 2014

Copy link
Copy Markdown
Owner

Sorry for the late pick up, but do we want this merged in?

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

Successfully merging this pull request may close these issues.

3 participants