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, 23 Jun 2011 16:26:08 +1200
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: David Flanagan <dflanagan@mozilla.com>, Jonas Sicking <jonas@sicking.cc>, Allen Wirfs-Brock <allen@wirfs-brock.com>, public-script-coord@w3.org
Message-ID: <20110623042608.GH7924@wok.mcc.id.au>
Boris Zbarsky:
> Defining an expando needs to make sure that there is no element in the
> collection that has that name/id.  But that information is maintained
> lazily, so typically the expando definition will need to first make sure
> the collection's state is up to date and then go and check whether any
> of the items in the collection have that name or id.  This last bit
> could be fast if the collection maintains some sort of hashtable mapping
> names to elements, or it might involve checking each node in the collection.

OK, understood.

> >Also, if there’s a scheme that isn’t slow that you would prefer (and has
> >the desired compatibility characteristics), I’m happy to consider
> >changing to that.
> 
> I'm not quite sure there is...  I haven't thought of one yet, at least.
> 
> I assume letting property definitions define the property but have the
> getter keep shadowing it as long as something in the collection has that
> name, is too crazy, for example.  ;)

I wondered about that approach.  I think it isn’t too crazy; it at least
features a different kind of consistency. :)  The current design is only
slightly less surprising.

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Thursday, 23 June 2011 04:26:55 UTC

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