Re: indexed properties on NodeLists and HTMLCollections

Boris Zbarsky:
> On 5/8/11 6:28 PM, Cameron McCormack wrote:
> >* [[GetOwnProperty]] does:
> >     * If the property name is a current indexed property, then return
> >       a {configurable:false,enumerable:true,get:fn} where fn returns the
> >       relevant Node.
> 
> Why is this better than just returning a value descriptor with the right
> node?  I can see at least one way in which it's worse: it involves
> reifying some sort of per-index getter function...

Good point, that is worse.  A non-writable data property it is.

> The upshot of this proposal is that array properties just shadow
> "normal" properties, right?  I'm in favor of that, whatever we need the
> spec-lawyering to be to make it work.

Yes.

> Hmm.  So it would affect what item() returns too?  That could be a
> little odd...  But I suppose livable.

You know, maybe it was too clever a suggestion.  We probably need to
think more holistically about DOM object freezing/sealing.  If we
specifically want to allow converting a live NodeList into a dead one, a
dedicated API would probably be more straightforward.

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Monday, 9 May 2011 02:32:02 UTC