W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1999

Re: Live NodeLists (Re: The DOM is not a model, it is a library!)

From: Stephen R. Savitzky <steve@rsv.ricoh.com>
Date: 07 Oct 1999 09:46:14 -0700
To: DOM Mailing List <www-dom@w3.org>
Message-ID: <qcvh8jp19l.fsf@congo.crc.ricoh.com>
Arnaud Le Hors <lehors@w3.org> writes:

> While I don't like NodeList myself, I personnaly don't have any
> particular problem to implement the live aspect of them. It's actually
> easier for me to have them live since they are a simple wrapper on top
> of my own structure which has nothing like that, and which is definitely
> "live". Making NodeLists "dead" would mean for me to actually allocate
> an array to "save" their state at creation time, which is something I
> don't currently need. Could someone tell me what the problem with live
> NodeLists is? Actually, my expectation is rather that they cause more
> troubles to the user than the implementor.

The problem is that the underlying structure, in almost all cases, is
going to be something like a TreeWalker with an appropriate filter.  In
order to access the Nth item in the nodelist, it is necessary to restart the
traversal from the root of the tree in case any nodes in the tree have
changed.  It may be possible to avoid this with some kind of timestamp
scheme, but it's certainly an additional complication that most implementors
don't want to think about, and imposes additional overhead. 

Now that TreeWalker is back in the spec, I would expect getElementsByTagName
to rapidly fall into disuse. 

Stephen R. Savitzky  <steve@rsv.ricoh.com>  <http://rsv.ricoh.com/~steve/>
Platform for Information Applications:      <http://RiSource.org/PIA/>
Chief Software Scientist, Ricoh Silicon Valley, Inc. Calif. Research Center
 voice: 650.496.5710  front desk: 650.496.5700  fax: 650.854.8740 
  home: <steve@theStarport.org> URL: http://theStarport.org/people/steve/
Received on Thursday, 7 October 1999 12:46:48 UTC

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