Re: ElementTraversal spec draft

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 UTC