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

Re: question: NodeIterator in DOM

From: Mike Champion <mcc@arbortext.com>
Date: Fri, 15 May 1998 10:53:07 -0400
Message-Id: <98May15.105314edt.26883@thicket.arbortext.com>
To: akitoshi.yoshida@sap-ag.de (Akitoshi Yoshida), xml-dev@ic.ac.uk, www-dom@w3.org
At 07:31 AM 5/15/98 -0400, Akitoshi Yoshida wrote:
>Hi,
>I have a question on NodeIterator in DOM-19980416.
>
>Excerpt from the spec:
>
>  If a node is inserted before the node just after
>  the iterator position, it will be returned by getNextNode();
>  likewise if a node is inserted after the node just previous
>  to the iterator position, it will be return by the next
>  getPrevNode() call.
>
>The first part is clear. When a Node is inserted by insertBefore()
>at the node just before the iterator position, the iterator position
>is set in front of this new node. The second part
>starting "likewise.." is not clear to me.  Are we assuming the
>existance of the insertAfter() method? It sounds like the
>insertion position (relative to the nodes) is the same as
>in the first case. If we only have the
>insertBefore() method in the Node inteface,
>how can we distinguish the above two cases?

It's better to post DOM questions on www-dom@w3.org.  I'll answer here and
cc: to ww-dom so please look there for any followup.

But anyway, Good Point!  We can't distinguish the two cases and I have no
idea what I was thinking when I typed it.  I'll remove the clause starting
with "likewise" from the spec.


It should work as follows.  Consider an iterator through nodes A, B, C.
The last node returned was B, so the "current position" signified by the
"^" is after B.   

   A --------B--^-----C     

If a new node X is inserted between B and C, the current position remains
after B, so X will be returned by getNextNode(), and B returned by
getPrevNode().

   A --------B--^-----X--------C

Sorry for the confusion,

Mike Champion
Received on Friday, 15 May 1998 10:56:14 GMT

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