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

[whatwg] DOMTokenList is unordered but yet requires sorting

From: Simon Pieters <simonp@opera.com>
Date: Mon, 18 May 2009 09:18:17 +0200
Message-ID: <op.ut36kmc7idj3kv@simon-pieterss-macbook.local>
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

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:49 UTC