[whatwg] DOMTokenList is unordered but yet requires sorting

On Thu, 14 May 2009 22:58:20 +0200, Erik Arvidsson <erik.arvidsson at gmail.com> wrote:

> On Thu, May 14, 2009 at 00:30, Kristof Zelechovski
> <giecrilj at stegny.2a.pl> wrote:
>> If a token list represented an ordered set, it could not be sorted to  
>> get an
>> item because the host would have to preserve the original (document)  
>> order
>> of tokens.
>
> The question is why does the set need to be ordered at all as long as
> it is stable between changes? It would make implementations more
> efficient with little no no loss in functionality.

Immagine if it is specified that the order is not relevant and implementations can use any order (so long as it's stable). So one UA uses one order and another uses another. Then one of those UAs becomes very popular. Web pages start to depend on the order of the popular UA (e.g. they use the first item and expect it to be the "right" one). Now those pages don't work in the less popular UA and that UA vendor has to reverse engineer the popular UA and implement the same order.

The above has happened with the DOM Core .attributes attribute, IIRC.

-- 
Simon Pieters
Opera Software

Received on Monday, 18 May 2009 00:18:17 UTC