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

Re: indexed properties on NodeLists and HTMLCollections

From: Cameron McCormack <cam@mcc.id.au>
Date: Fri, 17 Jun 2011 12:50:48 +1200
To: David Flanagan <dflanagan@mozilla.com>
Cc: Boris Zbarsky <bzbarsky@MIT.EDU>, Jonas Sicking <jonas@sicking.cc>, Allen Wirfs-Brock <allen@wirfs-brock.com>, public-script-coord@w3.org
Message-ID: <20110617005048.GI11042@wok.mcc.id.au>
David Flanagan:
> I like this.  It is basically what I've done for dom.js, and I've
> pasted my proxy handler code for NodeList below in case anyone is
> interested.


> I'd like it even better if the length attribute could appear to be
> an own value property like the index properties, too.  The get
> method in the proxy handler code below has to go through some
> contortions to invoke the length attribute getter function on the
> right object.  And since I expect the length property of NodeList to
> be frequently used, it is unfortunate that it can't be more
> efficient to access.

Hmm.  So length is defined in the DOM IDL as being a regular IDL
attribute.  Are the contortions you go through in the get handler
anything particular to length, though?  Or does it just apply to any
property that is an accessor property?  (Why is is that you need to
define get, instead of relying on the default implementation of this
derived trap?)

Cameron McCormack ≝ http://mcc.id.au/
Received on Friday, 17 June 2011 00:51:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:03 UTC