Re: Yet Another NodeList Question

-----Original Message-----
From: Harold Poskanzer <hmp@infoseek.com>
To: www-dom@w3.org <www-dom@w3.org>
Date: Friday, March 19, 1999 3:37 PM
Subject: Yet Another NodeList Question


>
>Since a NodeList is a "live view" into the tree, what does nextSibling do
on
>items in a NodeList?  It would seem like it should return the next sibling
in
>the tree, not the next sibling in the NodeList.  However, that makes
stepping
>through items in an "abstract" NodeList (like that generated from
>getElementsByTagName) a little difficult.

getNextSibling() called on a Node returned from an iterator, a NodeList,
etc. should return its sibling in the tree.  getNext (or whatever we call
it) on an iterator will return the next node in the set being iterated over.
There is no "next" operation on a NodeList; you get the next by incrementing
the index passed to the item() method.

I prefer to think of all NodeLists (and iterators) as abstract references
into the tree rather than physical lists into which nodes are copied from
the tree.

Does that help?

Mike Champion

Received on Friday, 19 March 1999 16:00:18 UTC