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

Re: Clarification on "live NodeList"

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Tue, 07 Jul 2009 23:24:51 -0700
Message-ID: <4A543BB3.2020205@terrainformatica.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: HTML WG <public-html@w3.org>
Boris Zbarsky wrote:
> 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.

I am not sure I understand how you would return the same instance
of NodeList for different elements that were used to invoke 
getElementsByName() with.

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

To be honest that reasoning sounds like "to be compatible with design 
flaws of our forefathers". The road to programmer's hell is paved by
"bug compatibility patches". I think Web technology already
got enough of those and you probably one of the best persons who know
this.

In any case HTML5 highnesses decided to deprecate <font> and <frameset>.
Even deprecation will break the Web as there are no alternatives to
<frameset> splitter behavior. And I simply don't know what WYSIWYG
editor shall insert when user decide to apply different font in it.

Back to the problem: I do not see what would be a problem to declare
  getElementsByClassName() & friends as returning something like
StaticNodeList (: public NodeList) as one wise person put here:

http://dev.w3.org/2006/webapi/selectors-api/draft/selectors-api.htm#staticnodelist


> -Boris
> 

-- 
Andrew Fedoniouk.

http://terrainformatica.com
Received on Wednesday, 8 July 2009 06:25:11 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:47 UTC