Re: Yet Another NodeList Question

Harold Poskanzer wrote:

> Since a NodeList is a "live view" into the tree, what does nextSibling do on
> items in a NodeList?

When you've fetched a Node out of a NodeList, it doesn't know it
was *in* a NodeList, so nextSibling is the Node on its right
in the tree, not its successor in the list.

> However, that makes stepping
> through items in an "abstract" NodeList (like that generated from
> getElementsByTagName) a little difficult.

Use the index method, being careful to note what you are doing
(i.e. if you are removing each node as you find it, always ask
for index(0) each time).

-- 
John Cowan	http://www.ccil.org/~cowan		cowan@ccil.org
	You tollerday donsk?  N.  You tolkatiff scowegian?  Nn.
	You spigotty anglease?  Nnn.  You phonio saxo?  Nnnn.
		Clear all so!  'Tis a Jute.... (Finnegans Wake 16.5)

Received on Friday, 19 March 1999 15:50:16 UTC