Property enumeration for NodeList, etc.

Cameron,

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?

     David

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