Re: indexed properties on NodeLists and HTMLCollections

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.

Great.

> 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