Property enumeration for NodeList, etc.


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 
> <> (neither for 
> host exception objects 
> <>). 
> However, if a host object implements an interface that supports 
> indexed 
> <> 
> or named properties 
> <>, 
> then properties on the object MUST be enumerated in the following order:
>    1. If the object supports indexed properties
>       <>,
>       then the object's supported property indexes
>       <>
>       are enumerated first, in numerical order.
>    2. If the object supports named properties
>       <>,
>       then the object's 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