W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2011

Re: Property enumeration for NodeList, etc.

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sat, 18 Jun 2011 00:42:56 -0400
Message-ID: <4DFC2CD0.4090901@mit.edu>
To: public-script-coord@w3.org
On 6/17/11 5:35 PM, David Flanagan wrote:
>>    3. No further own properties or properties from the objectís
>>       prototype chain are enumerated.
> Is point 3 for real? If I get a NodeList like document.childNodes and
> use it in a for/in loop, I'll just get the index elements and not the
> enumerable inherited length and item? And if I add an enumerable expando
> property to that NodeList, it won't be enumerated either?

For what it's worth, point 3 does not match the behavior of Chrome, 
Safari, Gecko, or Opera.

I don't have IE on hand to test right now.

> Is there any precedent for this? What other objects behave this way?

Array objects in JS, from an author perspective, but that's due to the 
various Array.prototype stuff and the length property not being 
enumerable.  Expandos are obviously enumerated for arrays.

Received on Saturday, 18 June 2011 04:43:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:03 UTC