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: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 17 Feb 2012 10:26:07 -0500
Message-ID: <4F3E718F.9040208@mit.edu>
To: Anne van Kesteren <annevk@opera.com>
CC: www-dom@w3.org
On 2/17/12 10:16 AM, Anne van Kesteren wrote:
> Do we want to keep NodeList around or is NodeList going away in favor of
> HTMLCollection? E.g. what should Node.childNodes return?

That's a good question.

There's a fundamental difference between Node.childNodes and the 
getElement* methods: the latter end up with a list of Elements only, 
while the former can contain other Node objects.  If the latter became 
an HTMLCollection, then the HTMLCollection IDL would need to change from 
Element to Node for the various return values, right?  This may not be 
an issue in practice, I guess, especially in JS.  And of course we'd 
need to change the definitions of namedItem and such very slightly so 
they make sense for lists that might contain non-elements.

I guess I don't have a strong opinion either way.  Implementation-wise, 
childNodes is implemented in a completely different way from the other 
lists in Gecko, so changing it would require additional work, but 
probably not a huge amount...

-Boris
Received on Friday, 17 February 2012 15:26:39 GMT

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