W3C home > Mailing lists > Public > public-html@w3.org > July 2009

Re: Clarification on "live NodeList"

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 07 Jul 2009 22:11:02 -0700
Message-ID: <4A542A66.4050006@mit.edu>
To: Andrew Fedoniouk <news@terrainformatica.com>
CC: HTML WG <public-html@w3.org>
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

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:05 UTC