This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23415 - DOMTokenList#toggle should be able to accept multiple classes to toggle
Summary: DOMTokenList#toggle should be able to accept multiple classes to toggle
Status: RESOLVED MOVED
Alias: None
Product: HTML.next
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-01 23:21 UTC by Michał Z. Gołębiowski
Modified: 2016-04-28 15:57 UTC (History)
3 users (show)

See Also:


Attachments

Description Michał Z. Gołębiowski 2013-10-01 23:21:51 UTC
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.
Comment 1 Charles McCathieNevile 2016-04-28 15:57:13 UTC
https://github.com/w3c/dom/issues/7 (It's actually a DOM issue)