[Bug 27114] New: DOMTokenList and DOMSettableTokenList should be constructible

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27114

            Bug ID: 27114
           Summary: DOMTokenList and DOMSettableTokenList should be
                    constructible
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DOM
          Assignee: annevk@annevk.nl
          Reporter: domenic@domenicdenicola.com
        QA Contact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, www-dom@w3.org

I would like to implement a custom element with an attribute that is a token
list, and another that is a settable token list. When I try to reflect these
attributes as properties, I would rather do them as instances of DOMTokenList
and DOMSettableTokenList than as my own custom types.

To be able to do this, both classes should be constructible. I think it'd be
fine if they just had empty constructors and developers had to call add() to
use them. You can imagine more complicated designs, e.g.:

- Pass a sequence<DOMString> and use that as the initial seed values
- Pass an element and an attribute and use mutation observers to monitor
changes to the attribute and automatically reflect them in the list

but empty constructor is fine.

Another use case besides custom elements is being able to create mock
DOMTokenLists for writing unit tests.

There is interest from Chrome in implementing this so we can implement more
HTML elements in JS.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Monday, 20 October 2014 21:06:28 UTC