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

Property enumeration for NodeList, etc.

From: David Flanagan <dflanagan@mozilla.com>
Date: Fri, 17 Jun 2011 14:35:36 -0700
Message-ID: <4DFBC8A8.1040806@mozilla.com>
To: public-script-coord@w3.org

I've just read your new (from 5/25) section on property enumeration order:
>         4.6.7. Property enumeration
> This document does not define a complete property enumeration order 
> for all host objects implementing interfaces 
> <http://dev.w3.org/2006/webapi/WebIDL/#dfn-interface> (neither for 
> host exception objects 
> <http://dev.w3.org/2006/webapi/WebIDL/#dfn-host-exception-object>). 
> However, if a host object implements an interface that supports 
> indexed 
> <http://dev.w3.org/2006/webapi/WebIDL/#dfn-support-indexed-properties> 
> or named properties 
> <http://dev.w3.org/2006/webapi/WebIDL/#dfn-support-named-properties>, 
> then properties on the object MUST be enumerated in the following order:
>    1. If the object supports indexed properties
>       <http://dev.w3.org/2006/webapi/WebIDL/#dfn-support-indexed-properties>,
>       then the object's supported property indexes
>       <http://dev.w3.org/2006/webapi/WebIDL/#dfn-supported-property-indexes>
>       are enumerated first, in numerical order.
>    2. If the object supports named properties
>       <http://dev.w3.org/2006/webapi/WebIDL/#dfn-support-named-properties>,
>       then the object's supported property names
>       <http://dev.w3.org/2006/webapi/WebIDL/#dfn-supported-property-names>
>       are enumerated next, in the order given in the definition of the
>       set of supported property names.
>    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?

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

Received on Friday, 17 June 2011 21:36:16 UTC

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