- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 20 May 2011 18:32:19 -0400
- To: public-script-coord@w3.org
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 prototype... > 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 browsers. > 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 _authors_. -Boris
Received on Friday, 20 May 2011 22:32:49 UTC