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

Liveness (NodeList, Traversal)

From: David Brownell <david-b@pacbell.net>
Date: Thu, 07 Oct 1999 12:00:07 -0700
Message-ID: <37FCEDB7.DF544C9B@pacbell.net>
To: DOM Mailing List <www-dom@w3.org>
"Stephen R. Savitzky" wrote:
> 
> Now that TreeWalker is back in the spec, I would expect
> getElementsByTagName to rapidly fall into disuse.

I'll disagree.  From an application evolution perspective, it's just
impractical -- people avoid changing working code unless they need to.
It may already be disused (as in my code :-), though.

There have been many discussions in the past about "liveness", and many
folk have argued that it can't ever be "simple and efficient".  It's also
got some nasty garbage collection interactions, which severely limit the
implementation choices ... there's really only one idiom that's easily
made efficient (indexing an unchanging tree, so you can cache a "current"
node and cound from there rather than restarting from the beginning).  The
issue is not unique to the "live" NodeLists of getElementsByTagName; it
also shows up with the L2 Traversal APIs.

The Traversal feature at least gets rid of the indexed access mode,
so there's an easily identified class of mutations that cannot affect
a TreeWalker or Iterator.  But the cost to detect those mutations
seems higher -- those GC interations are now inescapable, nodes need
to know about "live" iterators and there's no way to make iterators
become "dead" (removing such knowledge to make the iterator GC-able).

I'd dearly love an explanation why anyone thinks "liveness" is important.
My initial suspicion is that it's an issue that resonates more with folk
doing GUIs and browsers than with anyone else.

- Dave
Received on Thursday, 7 October 1999 15:00:32 GMT

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