W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2012

Re: [dom] Should the return values of getElementsByClassName/TagName/TagNameNS be HTMLCollection

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 23 Jan 2012 03:01:39 -0800
Message-ID: <CA+c2ei-TAxUcT0fBw872AHLWDxG=shS2S3kGFNt9qYZKCP2SQA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-dom@w3.org
On Mon, Jan 16, 2012 at 10:24 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> The cons I see are:
>
> 1)  More work for WebKit, which was arguably just following the spec.
> 2)  Existing code that only decorates NodeList.prototype but not
> HTMLCollection.prototype with something would no longer work for these
> return values in WebKit or Presto (it already doesn't work in Trident or
> Gecko).  It's possible that we could ameliorate this by making
> HTMLCollection inherit from NodeList, I guess.

Does HTMLCollection also have the fairly ugly 'named getter' behavior?
Having named getters mixed with built-in functions is both a recipe
for confusing behavior, as well as makes it harder to add more
built-in functions later.

For example, we've discussed adding a lot of the functions from
Array.prototype to NodeList.prototype. This is a risky venture if
those functions have names which collide with element-names on
HTMLCollections.

/ Jonas
Received on Monday, 23 January 2012 11:02:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:09 GMT