W3C home > Mailing lists > Public > www-dom@w3.org > January to March 1999

Re: Yet Another NodeList Question

From: Mike Champion <mike.champion@aliaron.com>
Date: Fri, 19 Mar 1999 15:59:46 -0500
Message-ID: <002801be724b$6ddbfd40$54ac45d1@mcc.aliaron>
To: <www-dom@w3.org>, "Harold Poskanzer" <hmp@infoseek.com>

-----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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT