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

Re: Robustness of root node in traversal

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Mon, 21 May 2001 09:29:10 -0400
To: <www-dom@w3.org>
Message-ID: <OF8938ABF9.4C7CE9BA-ON85256A53.00495615@pok.ibm.com>

> The DOM2 Traversal spec defines very well what should happen
> if the currentNode of a nodeIterator or treeWalker is moved
> in a document or out from it. However what should happen if
> the root node is moved in the tree?

Or the root's ancestor. The answer in either case is basically "nothing

NodeIterator operates only within, and upon, the root node's subtree.
Moving the root has no effect on the structure of the subtree, and hence
has no effect upon iteration.

TreeWalker operates as pure-current-node semantics. The root acts as a
fence preventing us from traversing out of it. (Actually, it's more like a
one-way gate; if you setCurrentNode to someplace outside the root you could
traverse back into the root but can't traverse out again.) Again, moving
the root has absolutely no effect if currentNode is within the root's
subtree (since the subtree moves with the root). If you've previously
created the odd outside-the-root condition, moving the root just changes
where the recapture will occur.

This seemed fairly obvious to the Traversal team, so we didn't state it
explicitly. Does it really need to be nailed down?

Joe Kesselman  / IBM Research
Received on Monday, 21 May 2001 09:29:39 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC