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

Re: Hello and NodeIterator Revisited

From: Craig Brozefsky <craig@duomo.onshore.com>
Date: 05 May 1998 16:03:15 -0500
To: Eric Vasilik <ericvas@microsoft.com>
Cc: www-dom <www-dom@w3.org>
Message-ID: <874sz4h1m4.fsf@duomo.onshore.com>
Eric Vasilik <ericvas@microsoft.com> writes:

> Consider the '*' character as the 'point' in the document.  Even though
> there is an iterator underneath the bold tag, the DOM would report that
> there are zero children for the bold.  Now, if one were to create and insert
> a node (say, and italic node) as a new child of the bold node, you have two
> options for updating the iterator:
> 
> 	X<B>*<I></I></B>Y, or
> 	X<B><I></I>*</B>Y
> 
> The iterator could go to the left of the newly inserted node, or to the
> right of it.  

I would say that the Iterator on the left is the correct way.  I am
assuming they are calling Node.insertBefore.  If the refChild is null,
which it would be if they were inserting into a Node with no present
children, it is supposed to append it at the end of the current list.
So I would put it after the iterator point, even tho it's the only
item in the list.

I suppose this could be interpreted different ways.

> Also, given my original example, what would happen to the iterator if the
> bold node were removed from the tree.  Again, you have two options:
> 
> 	X*Y, or
> 	XY
> 
> Stated in words: should the iterator remain in the document in which it was
> inserted, or should it be associated with the subtree in which it currently
> lives, and move with that subtree?

I would imagine it would stay within it's subtree.  The NodeIterator
doesn't seem to know that the tree or subtree exists.  It just talks
about the current Node's contents.  The TreeIterator is aware of
parents and can navigate between different levels in the tree, so I
would assume that it would stick with the subdoc it is in, and if that
is removed, it would go with those nodes and now it's ability to
navigate would be bounded to those nodes in the subtree.  Makes it a
little easier to deal with security issues, just return a TreeIterator
to a subdoc that has been ripped out of the whole document.  let them
make their changes and then push it back into the major tree.
Received on Tuesday, 5 May 1998 16:59:18 GMT

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