

Re: TreeWalker detach()

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Fri, 18 Jan 2002 15:55:55 -0500
To: Elliotte Rusty Harold <elharo@metalab.unc.edu>
Cc: www-dom@w3.org
Message-ID: <OF6A61C501.F63EC61E-ON85256B45.0072219A@pok.ibm.com>

>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 GMT
