Re: TreeWalker detach()

>Is there any particular reason NodeIterator has a detach() method and
>TreeWalker doesn't?

Because NodeIterator repairs itself as the document changes under it ("list
position semantics"), its implementations may involve event listeners or
the like which impose a performance burden on the DOM as long as the
NodeIterator is active. Having a way to deactivate it is therefore
important. Being able to do so immediately, rather than waiting until the
garbage collector (in GC langauges) gets around to cleaning it up, may make
a significant difference in application performance.

TreeWalker's "current node semantics" do not require fixup in response to
document mutation, so the same situation doesn't arise.

______________________________________
Joe Kesselman  / IBM Research

Received on Friday, 18 January 2002 15:56:32 UTC