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: Thu, 16 Jun 2011 12:25:46 +1200
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: Jonas Sicking <jonas@sicking.cc>, Allen Wirfs-Brock <allen@wirfs-brock.com>, public-script-coord@w3.org
Message-ID: <20110616002546.GF21000@wok.mcc.id.au>
Jonas Sicking:
> > Personally I think it makes things the most consistent with JS if
> > these properties appear as properties on the object itself as that
> > avoids using magic catch-all getters/setters on the proto chain.

Boris Zbarsky:
> I think that's a separate concern.  No one is proposing we use
> catchall getters/setters here.  The only question is how the behavior
> of the own properties is defined.

My plan was (and I’ve written a patch to the spec to do this but haven’t
committed it yet) to redefine [[GetOwnProperty]] (as opposed to [[Get]])
to make it appear like real own properties exist on the object.  That
means Object.getOwnPropertyDescriptor would return a descriptor for
these objects.

However, they would still be an additional layer on top of the “real” own
properties on the object (assuming we didn’t outlaw own array index
properties altogether like I suggested a couple of mails back), so that
if an item is removed from a collection, an own property with the same
name would be revealed again.

I just want to make sure that’s consistent with your “catch-all getters/
setters” comment.

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Thursday, 16 June 2011 00:26:22 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:03 UTC