Bug 148880
| Summary: | HTMLOptionsCollection.namedItem should return a NodeList when there are multiple matching nodes | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> |
| Component: | Forms | Assignee: | Keith Rollin <krollin> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | cdumez, krollin, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Ryosuke Niwa
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ryosuke Niwa
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
<rdar://problem/22590497>
Chris Dumez
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
I've filed a w3c-test bug: https://github.com/w3c/web-platform-tests/issues/2255
Keith Rollin
I've submitted a patch to the test and create a pull-request: https://github.com/w3c/web-platform-tests/pull/2302
Keith Rollin
Merged and closed (back in February).