Boris Zbarsky bzbarsky at MIT.EDU
Fri Mar 7 06:06:58 PST 2014

On 3/6/14 6:45 PM, C. Scott Ananian wrote:
> And don't forget the related `DOMTokenList`, which is in
> Element.classList and thus used by everyone always.

How is it related?  DOMTokenList is indeed an API for a list of strings 
(sort of; they're pretty restricted in terms of what strings they can 
be), but has a bunch of other functionality that DOMStringList does not 
have and that ES arrays don't have and shouldn't have.  toggle() doesn't 
make sense on arrays in general, for example.

> The `contains` and `item` methods are in `DOMTokenList`, so they
> probably shouldn't be removed from `DOMStringList`.

I think I missed a logical connection here.  Can you expand on the 
reasoning here?

> But I don't think anyone was seriously proposing that

_I_ am seriously proposing that DOMStringList go away compeletely and 
APIs that return it just return Arrays.  Not subclasses of Arrays, just 

> (and maybe `DOMTokenList` would also be related to `Array`?)

DOMTokenList is writable and the writes must enforce all sorts of 
invariants that Arrays do not enforce, so making it a subclass of Array 
would be slightly odd, actually.  The main benefit would be to get map() 
and company working on it, which may be worth it.


More information about the es-discuss mailing list