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

RE: Alternative to the Live NodeIterator

From: Andrew n marshall <amarshal@usc.edu>
Date: Fri, 1 May 1998 09:31:41 -0700
To: "Peter Sharpe" <peter@sqwest.bc.ca>, <www-dom@w3.org>
Message-ID: <000201bd751e$9f0e38e0$25e37d80@philica>
> -----Original Message-----
> From: Peter Sharpe
> Subject: RE: Alternative to the Live NodeIterator
 . . .
> Any object which contains a reference to one or more nodes in the tree will
> have
> to be "maintained" during editing operations. There are many ways
> to implement
> this, obviously, but one way, conceptually at least, is to have methods like
> beforeDelete(Node nodeBeingDeleted), afterInsert(Node
> nodeBeingInserted), etc.
> If you implement your iterators as a linked list then on a Node delete
> operation
> you can call
>   myIteratorClass::beforeDelete(Node nodeBeingDeleted) {
>     if nodeBeingDeleted is something I reference then
>        fix up my reference by finding an appropriate node that will still
>        be around after nodeBeingDeleted is gone.
>     }
>     nextIterator()->beforeDelete(nodeBeingDeleted);
>   }

Yes.  This is an excelent way to create the iterator class proposed in the
spec.  In fact, this is very similar to the Visitor model Don Park mentioned.

My point is it requires the document tree to have a reference to the Iterator
so this update can be made.  And as Don Park also mentioned, these reference
need a release mechanism.

Andrew n marshall
  student - artist - programmer
      "Everyone a mentor, Everyone a pupil"
Received on Friday, 1 May 1998 12:23:42 UTC

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