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

On Tue, 17 Jan 2012 07:24:56 +0100, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> The current IDL says that these return NodeList.  We have people who'd  
> like to align Gecko with that, but I have a slight concern about it.  In  
> particular:
>
> 1)  Gecko has returned HTMLCollections from these methods for a long  
> time.
> 2)  IE returns HTMLCollections from these methods.
> 3)  Opera returns NodeLists from these methods, but Opera has a  
> namedItem method on NodeList.prototype
>
> So scripts that just use namedItem() on these objects work in every UA  
> except the WebKit-based ones at the moment.  This makes me worry about  
> web compat issues if we stop having a namedItem on these return values  
> in Gecko.
>
> Is there a reason these return values are not HTMLCollection, other than  
> historical reasons dating back to when HTMLCollection wasn't in core DOM?

Do we want to keep NodeList around or is NodeList going away in favor of  
HTMLCollection? E.g. what should Node.childNodes return?

Changing this for getElementsBy* friends is not a problem for Opera. Gecko  
and IE already do it. People from Chrome cc'd themselves to  
https://www.w3.org/Bugs/Public/show_bug.cgi?id=13999 (the bug for this  
issue) but expressed no opinion. Anyone from WebKit who cares one way or  
another?


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Friday, 17 February 2012 15:17:01 UTC