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

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

From: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Date: Tue, 01 Apr 2008 17:41:56 +0200
Message-ID: <47F257C4.8030803@disruptive-innovations.com>
To: Henri Sivonen <hsivonen@iki.fi>
Cc: "Web APIs WG (public)" <public-webapi@w3.org>

Henri Sivonen wrote:

> How often do people pick a single child by index (with a number know a 
> priori) instead of iterating over children and testing each one for an 
> interesting trait?

Let me turn the problem differently : NodeList and NamedNodeMap are the
normal answers when we query a list of nodes, for instance through
Document.getElementsByTagName() or Element.childNodes, why should this
behave differently and why should the DOM be inconsistent here ?
I must add that XPath also allows to select the nth child of a given
element, that Selectors can do the same through
|#myParent > :nth-child(n)|.

Apparently querying the nth element child of an element is NOT that

and the list is much longer.

Received on Tuesday, 1 April 2008 15:42:35 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:10:00 UTC