W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2011

[whatwg] DOMTokenList methods would be more useful with a space separated token list

From: David Håsäther <hasather@gmail.com>
Date: Fri, 28 Oct 2011 12:58:01 +0200
Message-ID: <CAMPaTMeDzstVqDKtKEqsmsGtfgiD7LAm4LBpbEuVbcyArt5WdQ@mail.gmail.com>
It would be more useful if the DOMTokenList methods (contains, add,
remove, toggle) would take a space separated list of tokens. This is
the behavior most DOM libraries have when dealing with class names.

So, when setting two classes, instead of


you could do

    ele.classList.add("hey ho");

Currently, the latter results in an INVALID_CHARACTER_ERR.

The behavior of all methods should be obvious I guess.

David H?s?ther
Received on Friday, 28 October 2011 03:58:01 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:37 UTC