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.
This bug was found by the newly added test: LayoutTests/http/tests/w3c/html/semantics/forms/the-select-element/common-HTMLOptionsCollection-namedItem.html
<rdar://problem/22590497>
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?
I've filed a w3c-test bug: https://github.com/w3c/web-platform-tests/issues/2255
I've submitted a patch to the test and create a pull-request: https://github.com/w3c/web-platform-tests/pull/2302
Merged and closed (back in February).