[whatwg] Why do HTML*Collection's nameItem need to return 5 different objects?
Ojan Vafai
ojan at chromium.org
Thu Sep 6 08:34:53 PDT 2012
On Wed, Sep 5, 2012 at 1:47 PM, Ian Hickson <ian at hixie.ch> wrote:
> For HTMLOptionsElement, the situation is more murky.
>
> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1739
>
> From what I can tell, IE doesn't do direct named access, you have to do it
> via item() or namedItem(). The spec didn't support item() access for
> names, though all the browsers did. I've filed a bug on DOM Core for that.
> Using namedItem(), you see that IE returns a live HTMLCollection, the spec
> returns a live NodeList, WebKit returns a static NodeList, and Opera and
> Firefox return just the first option. (There's a note in the spec asking
> if we should switch to HTMLCollection rather than NodeList.)
I haven't followed the details closely enough to know which APIs should be
returning which types of lists/collections. As a general point though,
anywhere we can avoid live NodeLists/Collections is a big improvement. They
impose a significant implementation cost both in terms of complexity and in
terms of performance impact.
More information about the whatwg
mailing list