Re: Move length property to the set of supported property indicies?

On 5/20/11 6:17 PM, David Flanagan wrote:
> Are there any DOM interfaces that define index getters that do not also
> define length properties?

Not to my knowledge.

> If not, how about removing the length property from the interface and
> making it one of the "supported property indices"?

It has completely different behavior from the indexed properties wrt 
expandos and the like.

In addition, this would make it impossible to override it on the 

> Webkit browsers
> already seem to do it this way. (e.g. for a NodeList n,
> n.hasOwnProperty("length") is true).

This is true for _all_ properties on _all_ DOM objects in WebKit based 

> My experience is implementing NodeList in pure JavaScript (using
> Proxy.create()). The Proxy object knows the length of the list and could
> return it. But if it has to allow the NodeList.prototype.length getter
> function to return the value the implementation becomes more complex and
> requires a WeakMap in addition to the Proxy object.
> Since there is already browser incompatibility out there, could we
> standardize the implementation technique that is easier?

While I agree that having length be an own property is somewhat easier 
to implement, the fact that it would then behave totally different from 
all the other "non-live" DOM properties seems like a bad thing for 


Received on Friday, 20 May 2011 22:32:49 UTC