Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Make DOMtokenlist toggle() work on multiple things? #7

Open
chaals opened this issue Apr 28, 2016 · 1 comment
Open

Make DOMtokenlist toggle() work on multiple things? #7

chaals opened this issue Apr 28, 2016 · 1 comment

Comments

@chaals
Copy link
Collaborator

chaals commented Apr 28, 2016

Moved from bugzilla

Current DOMTokenList spec lets add/remove methods to be passed multiple classes. However, the toggle method didn't get such a possibility due to the second boolean optional parameter.
This is inconsequent and limiting. I propose to change the signature to:

boolean toggle(DOMString... tokens, optional boolean force);

The change would mean that the force parameter is not necessarily the second one but the last one on the list of parameters, e.g. in JavaScript the force parameter would be equal to:

arguments[arguments.length - 1]

within the function body.

Not adding such support would still require libraries like jQuery to patch the classList.toggle method to fulfill its semantics of being able to accept multiple classes.

@yongsheng
Copy link
Collaborator

I guess this change is not implemented by any user agents. maybe consider it later.

@xfq xfq added enhancement and removed question labels Dec 18, 2017
@xfq xfq added this to the future milestone Dec 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants