[whatwg] DOMTokenList is unordered but yet requires sorting

Erik Arvidsson erik.arvidsson at gmail.com
Wed May 13 08:45:06 PDT 2009


Section 2.9.3 DOMTokenList says:

The DOMTokenList interface represents an interface to an underlying string
that consists of an *unordered* set of unique space-separated tokens.


Yet, the item method says:

The item(index) method must split the underlying string on spaces, *sort the
resulting list of tokens by Unicode code point*, remove exact duplicates,
and then return the indexth item in this list. If index is equal to or
greater than the number of tokens, then the method must return null.


What is the reason for requiring the set to be ordered in
item? It seems reasonable to say that the order of item is
implementation specific but require that it is stable between changes
of the class name.
If we still want to enforce that item returns the items in the sorted order
we should change the spec to say that DOMTokenList represents an ordered set
instead.


-- 
erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090513/92cebb94/attachment.htm>


More information about the whatwg mailing list