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

Re: ElementTraversal spec draft

From: Doug Schepers <doug.schepers@vectoreal.com>
Date: Tue, 03 Apr 2007 15:59:17 -0400
Message-ID: <4612B215.40909@vectoreal.com>
To: public-webapi@w3.org

Hi, Maciej-

Thanks for the feedback.

Maciej Stachowiak wrote:
> 
> On Apr 3, 2007, at 9:50 AM, Doug Schepers wrote:
> 
>> 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.

This is why I suggested making it a static list.


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

But that doesn't get you the number of child elements.

I'm speaking as an author when I say that this would be extremely 
useful, particularly (but not only) for SVG.  Laying out elements (and 
thus needing the number of them) is a very common task.

Regards-
-Doug
-- 

Regards-
-Doug

Research and Standards Engineer
6th Sense Analytics
www.6thsenseanalytics.com
mobile: 919.824.5482
Received on Tuesday, 3 April 2007 19:59:37 GMT

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