Re: [Element Traversal LC] access to element by index

* Daniel Glazman wrote:
>1. congrats for this spec, I love it ; I can't count how many times in
>    page or chrome script I am filtering out nodes that are not element
>    nodes.
>
>2. the ElementTraversal interface has a |childElementCount| attribute
>    but misses access to an individual childElement based on its index.
>    That would be really useful. Two solutions here :
>
>    a. you remove the childElementCount attribute in favor of a
>
>         readonly attribute NodeList    childElements;
>
>       and that NodeList has all we need

It was the SVG Working Group that originally came up with the interface
and they, as I understand it, decided against having any NodeList in the
SVG Tiny 1.2 DOM. They rather introduced the interface to allow imple-
mentations to discard some nodes like comments and text nodes with only
white space while keeping compatibility with implementations that keep
them. I would imagine they would be unhappy with such a change.

>    b. you add
>
>         Node    item(in unsigned long index);
>
>       but that is not really consistent with the existing way of
>       querying list of nodes.
>
>    My very strong preference goes to solution a.

At the least you would need a different name as this would go on all
element nodes and you would probably run into name clashes quickly, and
confuse authors (NodeList.item vs. Element.item for example). However,
you could also just use XPath, or Selectors, or one of the many other
methods for this particular case, I don't think this addition is needed.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Friday, 28 March 2008 15:48:12 UTC