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


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 Rasmus	  "A man that cannot walk has to fly"     Wienberg +
Received on Thursday, 2 April 1998 06:24:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:36:42 UTC