[whatwg] Why do HTML*Collection's nameItem need to return 5 different objects?
Ryosuke Niwa
rniwa at webkit.org
Fri Jul 13 15:23:39 PDT 2012
On Fri, Jul 13, 2012 at 3:17 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Fri, 13 Jul 2012, Ryosuke Niwa wrote:
> >
> > According to
> >
> http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlpropertiescollection
> >
> > *HTMLCollection* returns the first element.
>
> This is for compat in the default case, I believe.
>
>
> > *HTMLAllCollection* returns the first element or another
> HTMLAllCollection
> > if there are multiple elements
>
> This is needed for IE compat.
>
We can't use live NodeList or a regular HTMLCollection?
> *HTMLFormControlsCollection* returns the first element or RadioNodeList if
> > there are multiple elements
>
> This is needed to support the radio button value feature.
>
>
> > *HTMLOptionsCollection* returns the first element or live NodeList if
> there
> > are multiple elements
>
> This is for compat, I believe. (We don't want to return just a node if
> there are many matching.)
>
We can't return HTMLAllCollection or RadioNodeList here?
> Can those 3 classes somehow return the same object? FWIW, WebKit has
> > always returned a static node list.
>
> WebKit doesn't support the microdata and radio button features,
> presumably, and is presumably less than perfectly compatible with the Web
> for the others. :-)
>
I'm not certain if we're willing to change our behavior to match the spec.
We haven't gotten any bug reports due to this behavior as far as I know,
and following the spec introduces a significant code complexity.
- Ryosuke
More information about the whatwg
mailing list