W3C home > Mailing lists > Public > public-webapi@w3.org > April 2007

Re: ElementTraversal spec draft

From: Maciej Stachowiak <mjs@apple.com>
Date: Tue, 3 Apr 2007 12:51:27 -0700
Message-Id: <31728CA3-BC67-4855-9798-D2B93B7B90EE@apple.com>
Cc: public-webapi@w3.org
To: Doug Schepers <doug.schepers@vectoreal.com>


On Apr 3, 2007, at 9:50 AM, Doug Schepers wrote:

>
> Hi-
>
> The issue of live vs. static lists is actually orthogonal to my  
> main question (though that would be a relevant argument to bring to  
> the Selectors spec, which uses a static list... I think that ship  
> may have sailed, though).
>
> The functionality I was requesting primary feedback on was whether  
> or not to include an interface in the ElementTraversal spec which  
> would provide a list of elements (not nodes, which could include  
> spaces and line breaks, etc.) that are children of the context  
> element.

I suggest leaving this out, because it's not possible to implement  
both next/previous and indexed access in a way that is efficient for  
all cases (it's possible to make it fast for most cases but pretty  
challenging to make it efficient for all). This is especially bad  
with a live list and an element whose contents may be changing while  
you are iterating.

If all you care about is looping through once, writing the loop with  
nextElementSibling is not significantly harder than indexing a list.

Regards,
Maciej
Received on Tuesday, 3 April 2007 19:51:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:57 GMT