Created attachment 136159 [details] Testcase Load the attached testcase. It should say PASS, and does in non-WebKit browsers. In WebKit it says FAIL.
The difference with Firefox is that our result is a NodeList, not an HTMLImageElement. Re-titling the bug accordingly. The attached test case tests this in a very roundabout way, so we need to test what IE actually does - even if the test passes there, it might be for another reason. I'm not sure why we have this behavior, it seems like it was intentional at some point.
I will bet you money you have this behavior because document.all needs it and as far as I can tell WebKit made document.all a vanilla HTMLCollection and propagated all its insanity to all HTMLCollections....
The implementations for namedItem are separate for document.all and other collections (in the bindings, which are custom), but they do the same thing. By looking at the history, it seems HTMLCollection.namedItem has always returned a list when there's more than one element with the same name (and maybe always at first). Doesn't seem to be due to wanting to align with document.all.
I am unable to reproduce this bug in Safari 15.6 on macOS 12.5 using attached test case and it is showing "PASS" and it is matching with other browsers (Chrome Canary 106 and Firefox Nightly 105). I think it was fixed along the way and can be marked as "RESOLVED CONFIGURATION CHANGED". Thanks!