RESOLVED FIXED 148880
HTMLOptionsCollection.namedItem should return a NodeList when there are multiple matching nodes
https://bugs.webkit.org/show_bug.cgi?id=148880
Summary HTMLOptionsCollection.namedItem should return a NodeList when there are multi...
Ryosuke Niwa
Reported 2015-09-04 20:33:46 PDT
See https://html.spec.whatwg.org/multipage/infrastructure.html#htmloptionscollection Unlike named getters, we must return a NodeList that contain the list of all matching nodes in HTMLOptionCollection.namedItem.
Attachments
Ryosuke Niwa
Comment 1 2015-09-04 20:34:23 PDT
This bug was found by the newly added test: LayoutTests/http/tests/w3c/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem.html
Radar WebKit Bug Importer
Comment 2 2015-09-04 20:34:25 PDT
Chris Dumez
Comment 3 2015-10-14 09:52:12 PDT
Where is this in the spec? The IDL says namedItem() returns an Element. And there is this comment: """ element = collection . namedItem(name) element = collection[name] Returns the item with ID or name name from the collection. If there are multiple matching items, then the first is returned. """ Therefore, the spec seems to indicate we should NOT return a NodeList. Maybe it is a bug in the test?
Keith Rollin
Comment 4 2015-10-14 10:45:39 PDT
Keith Rollin
Comment 5 2015-11-03 12:48:23 PST
I've submitted a patch to the test and create a pull-request: https://github.com/w3c/web-platform-tests/pull/2302
Keith Rollin
Comment 6 2016-10-12 12:55:36 PDT
Merged and closed (back in February).
Note You need to log in before you can comment on or make changes to this bug.