W3C home > Mailing lists > Public > www-dom@w3.org > April to June 1998

Iterators and removing

From: Axel Wienberg <awienber@hoxsun03.higher-order.de>
Date: Thu, 2 Apr 1998 13:21:48 +0200
Message-Id: <199804021121.NAA22797@hoxsun03.higher-order.de>
To: www-dom@w3.org

Hi,

I've got a question on the behaviour of NodeIterators.  What is supposed to
happen if the current node of an iterator is removed from its parent?

The method toNext() of NodeIterator is defined as follows:

   This method alters the internal state of the iterator such that the node it
   references is the next in the sequence the iterator is presenting relative
   to the current position.

But now the node is no longer part of the sequence represented by the iterator.
This case actually occurs if you want to conditionally remove the children of
some node.

It gets even more confusing if you reinsert the node at a different position as
a child of the same parent: Does the Iterator move along with its node?  Or
what if you insert it as a child of an entirely different parent?

Enlightment appreciated,
	Axel

----------------------------------------------------------------------
+ Axel Rasmus	  "A man that cannot walk has to fly"     Wienberg +
Received on Thursday, 2 April 1998 06:24:45 GMT

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