W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2009

[whatwg] DOMTokenList is unordered but yet requires sorting

From: Erik Arvidsson <erik.arvidsson@gmail.com>
Date: Wed, 13 May 2009 08:45:06 -0700
Message-ID: <6eeb8bd10905130845o3f7e516dv50dedd35052f8979@mail.gmail.com>
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090513/92cebb94/attachment.htm>
Received on Wednesday, 13 May 2009 08:45:06 UTC

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