Re: Clarification on "live NodeList"

Andrew Fedoniouk wrote:
> Call 10 times getElementsByName() and you will have 10 dangling lists
> that need to be handled on pretty much each DOM structure update (until
> GC will occur).

I see nothing in the spec that requires that each call return a new 
object (or heck, even if it did they could share the underlying 
updatable objects).  Some UAs in fact do not create a new object for 
every call in those circumstances.

> Of course caching and lazy evaluation tricks can be used for
> native implementation of document|element.getElementsByClassName() & Co.

Yep.

> And yet... Seems like no one need those NodeLists to be alive.
> I've never seen requests or even intimations on such requests to
> see them alive. Thus is the question: why? for what purpose?

To be compatible with the DOM Core specification and DOM HTML 
specifications.  In fact, all HTML5 defines is what "tagname" means for 
getElementsByTagName on HTML nodes and what "name" means in HTML.  The 
rest of the behavior is specified by the existing DOM specifications.

-Boris

Received on Wednesday, 8 July 2009 05:12:06 UTC