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.