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

On Sat, Feb 18, 2012 at 12:48 PM, Anne van Kesteren <annevk@opera.com> wrote:
> On Sat, 18 Feb 2012 18:12:06 +0100, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>>
>> On 2/18/12 3:28 AM, Anne van Kesteren wrote:
>>>
>>> Named getters are nice for authors, and besides, it was already pointed
>>> out it's not avoidable here:
>>> http://lists.w3.org/Archives/Public/www-dom/2012JanMar/0008.html
>>
>>
>> That's true, but Jonas raises a good point: we should certainly not add a
>> named getter to .childNodes, say.
>
>
> Well childNodes as you pointed out is a collection of nodes, not a
> collection of elements. I'm not sure it makes sense to expose element
> collections in wildly different ways, unless we want to discourage
> particular accessors.

Exposing it on more collections than needed will make it much harder
to deprecate the named getter. Until someone has measured (which I
believe both mozilla and google has the ability to do these days) I
think it's too early to say that we can't deprecate.

For example I'd hate it if we add named getters to the return value of
.querySelectorAll or .findAll.

/ Jonas

Received on Saturday, 18 February 2012 23:24:14 UTC