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

[whatwg] DOMTokenList is unordered but yet requires sorting

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 13 Jul 2009 04:00:23 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0907130359170.23663@hixie.dreamhostps.com>
On Mon, 15 Jun 2009, Jo?o Eiras wrote:
> On Mon, 15 Jun 2009 21:38:05 +0200, Darin Adler <darin at apple.com> wrote:
> > On Jun 15, 2009, at 12:22 PM, Ian Hickson wrote:
> > > On Tue, 9 Jun 2009, Erik Arvidsson wrote:
> > > > 
> > > > I was about to follow up on this. Requiring sorting which is O(n 
> > > > log n) for something that can be done in O(n) makes thing slower 
> > > > without any real benefit. Like Jo?o said the order should be 
> > > > defined as the order of the class content attribute.
> > > 
> > > Fair enough. Done.
> > 
> > Since DOMTokenList requires uniqueness, then I suspect it's still O(n 
> > log n) even without sorting, not O(n).
> 
> Oh, I have forseen that. Is it really necessary to remove duplicates ? I 
> imagine DOMTokenList to be similar to what can be achieved with a 
> String.split(), but then it would be just more duplicate functionality.

If we don't remove duplicates, then things like the .toggle() method could 
have some quite weird effects.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Sunday, 12 July 2009 21:00:23 UTC

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