W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

Re: Question on NodeList and client-server

From: John Cowan <cowan@locke.ccil.org>
Date: Fri, 16 Oct 1998 10:28:45 -0400
Message-ID: <3627581D.4822BD6E@locke.ccil.org>
To: DOM List <www-dom@w3.org>
Don Hamson wrote:

> Without copying the children to a private object
> instance, or locking children nodes;

In fact, neither of these things are possible with the DOM Level 1.

> how do I know that the length is valid
> when I attempt to iterate over the list?

You do not.  The only safe approach is to use nextSibling (and
even then you risk getting caught in a deleted subtree) or
to keep increasing the index until you get a null value.

The Level 1 DOM simply doesn't handle the case that someone other
than the XML/HTML parser is tampering with the node tree at the
same time that you are traversing it: multithreading is not
supported, except for the limited case of the parser (which can
only extend, never delete).

-- 
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, 16 October 1998 10:27:11 GMT

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