W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > September 2011

[Bug 13999] New: DOMTokenList (e.g., element.classList): allow to add/remove multiple tokens at once

From: <bugzilla@jessica.w3.org>
Date: Thu, 01 Sep 2011 17:50:45 +0000
To: public-html-bugzilla@w3.org
Message-ID: <bug-13999-2486@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=13999

           Summary: DOMTokenList (e.g., element.classList): allow to
                    add/remove multiple tokens at once
           Product: HTML WG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: LC1 HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: mtanalin@yandex.ru
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


http://www.w3.org/TR/html5/common-dom-interfaces.html#domtokenlist-0

DOMTokenList should be able to add/remove multiple tokens at once. In
particular, element.classList should be able to add or remove more than one
class at once.

For example, following should be possible:

element.classList.add("lorem ipsum dolor");
element.classList.remove("lorem ipsum dolor");

Additionally, it may make sense to allow to use Array instead of string as
argument:

element.classList.add(["lorem", "ipsum", "dolor"]);
element.classList.remove(["lorem", "ipsum", "dolor"]);

Currently, DOMTokenList is almost useless since element.classList is _slower_
than pure-script implementation when adding/removing multiple classes at once.

For example, jQuery _intentionally drops_ using element.classList exactly for
this reason:
http://bugs.jquery.com/ticket/5087

Adding multiple classes is widely used, for example, in jQuery UI.

Thanks.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Thursday, 1 September 2011 17:50:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 1 September 2011 17:50:54 GMT