- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 20 May 2011 19:12:51 -0400
- To: David Flanagan <dflanagan@mozilla.com>
- CC: public-script-coord@w3.org
On 5/20/11 6:56 PM, David Flanagan wrote: > I suspect that authors would expect the length property to behave just > like the array index properties with which it is intimately related. It doesn't behave like them in browsers now, though (e.g. it's never dynamically created or destroyed). > Conceptually, because length just seems to go with the array index > properties. I'm not sure I agree, but... > From an implementation standpoint, once I have a proxy that handles the > array index properties, I can implement item(n) like this without having > to use a WeakMap: > > NodeList.prototype.item = function(n) { r = this[n]; if (r===undefined) > return null; else return r; }; This implementation is incorrect, for what it's worth, in all sorts of ways, but I expect you knew that... With enough error-checking on n, I guess this could work. How are you planning to do HTMLCollection? -Boris
Received on Friday, 20 May 2011 23:13:21 UTC