W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2012

Re: [whatwg] Why do HTML*Collection's nameItem need to return 5 different objects?

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 13 Jul 2012 22:17:28 +0000 (UTC)
To: Ryosuke Niwa <rniwa@webkit.org>
Message-ID: <Pine.LNX.4.64.1207132215370.27616@ps20323.dreamhostps.com>
Cc: "<whatwg@whatwg.org>" <whatwg@whatwg.org>
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.

> *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.)

> *HTMLPropertiesCollection* returns PropertyNodeList

This is to support the value features for microdata.

> 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. :-)

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 13 July 2012 22:17:56 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:43 UTC