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

Re: Clarification on "live NodeList"

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Fri, 10 Jul 2009 15:52:47 -0700
Message-ID: <4A57C63F.8010100@terrainformatica.com>
To: Philip Taylor <pjt47@cam.ac.uk>
CC: Boris Zbarsky <bzbarsky@MIT.EDU>, HTML WG <public-html@w3.org>
Philip Taylor wrote:
> Boris Zbarsky wrote:
>> Andrew Fedoniouk wrote:
>>> Do you know any existing code that relies on liveness of NodeLists?
>>
>> I don't have pointers offhand, but sites out there do things like:
>>
>> var list = document.getElementsByTagName("something");
>> while (list.length) {
>>   list[0].parentNode.removeChild(list[0]);
>> }
>
> One pointer:
>
> http://archive.fantasysports.yahoo.com/archive/nba/2006/186942/rosters?mid=12&stat1=S&stat2=S_2006&sort=10 
>
>
> YAHOO.html.clearChildNodes says effectively:
>
>         if(nodeType != null && nodeType != 'undefined') {
>             var remNodes = atNode.getElementsByTagName(nodeType);
>         }
>         else {
>             var remNodes = atNode.childNodes;
>         }
>         var nodeLim = remNodes.length;
>         for(var x = 0; x<nodeLim; x++) {
>             atNode.removeChild(remNodes[0]);
>         }
>
I am not sure this piece will run at all.
remNodes will not be seen outside blocks where they declared: { var 
remNodes = whatever }

My condolences to YAHOO.html namespace.

But this counts as a proof that it might be some code in the wild that 
rely on this.
Non-effective at its best but now I know why batteries on mobile devices 
are dying on AJAX sites.

--
Andrew Fedoniouk.

http://terrainformatica.com
Received on Friday, 10 July 2009 22:53:30 UTC

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