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

Move length property to the set of supported property indicies?

From: David Flanagan <dflanagan@mozilla.com>
Date: Fri, 20 May 2011 15:17:37 -0700
Message-ID: <4DD6E881.9080201@mozilla.com>
To: public-script-coord@w3.org
Are there any DOM interfaces that define index getters that do not also 
define length properties?

If not, how about removing the length property from the interface and 
making it one of the "supported property indices"?  Webkit browsers 
already seem to do it this way.  (e.g. for a NodeList n, 
n.hasOwnProperty("length") is true).

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?

     David
Received on Friday, 20 May 2011 22:18:06 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:03 UTC