W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2010

Re: Allow to return same NodeList object for queries like getElementsByTagName, getElementsByClassName and getElementsByName

From: Maciej Stachowiak <mjs@apple.com>
Date: Fri, 12 Feb 2010 07:56:56 -0800
Cc: Anne van Kesteren <annevk@opera.com>, Anton Muhin <antonm@chromium.org>, public-webapps@w3.org
Message-id: <66686F4E-27CB-4C34-AC73-89427D6D3F80@apple.com>
To: Maciej Stachowiak <mjs@apple.com>

On Feb 12, 2010, at 7:53 AM, Maciej Stachowiak wrote:

>
>>
>> Also, what happens with garbage collection? Say some isolated piece  
>> of code does:
>>
>> x = document.getElementsByTagName("x")
>> x.p = 2
>>
>> ... and then later on some other piece of code does:
>>
>> y = document.getElementsByTagName("x")
>> w("p" in y)
>>
>> Depending on whether or not x got garbage collected you would get a  
>> different result.
>
> Indeed, that is what I cited as the one observable side effect.  
> (Except the other piece of code doesn't have to happen later, it  
> could be the very next line.)
>
> To the best of my knowledge, it is not common practice to add custom  
> properties to NodeLists, as opposed to Nodes, especially Elements,  
> where it is fairly common practice. The fact that you can never be  
> guaranteed to get the same NodeList back means

I meant to say: "The fact that you can never be guaranteed to get the  
same NodeList back means that doing this to NodeLists is of limited  
utility. Usually authors use custom properties to store additional  
data for later retrieval."

Regards,
Maciej
Received on Friday, 12 February 2010 15:57:30 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:37 GMT