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

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 UTC