Created attachment 119120 [details] Testcase Webkit apparently treats item() on form.elements and other HTMLCollections as an alias for namedItem if a string is passed or something. This is wrong per the spec at http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlformcontrolscollection as well as per the DOM 2 HTML spec. See the attached testcase; it should say "PASS" twice. BUILD: Current WebKit nightly. STEPS TO REPRODUCE: Load attached testcase. EXPECTED RESULTS: 2 lines that say "PASS" ACTUAL RESULTS: 2 lines that say "FAIL" Gecko and Presto both get this right.
> Gecko and Presto both get this right. This behavior was implemented in bug 11078 precisely to match Gecko and Presto (and document.all.item(someString) still works in Firefox 8.0.1). It might have gotten unintentionally extended to other versions of item() with code refactorings over the years. We should investigate which versions of item() need to fall back to namedItem().
Yeah, document.all is not an HTMLCollection and has completely different item() behavior in Firefox. Per HTML5 spec, it's an HTMLCollection, though. The spec probably needs fixing.
I filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=15184
*** Bug 74546 has been marked as a duplicate of this bug. ***
Created attachment 123898 [details] Patch
Comment on attachment 123898 [details] Patch This didn't cause any other tests to fail? Do we know the history of this code? Why does WebKit have this behavior?
Comment on attachment 123898 [details] Patch Ah, I see that Alexey answered that question above.
Comment on attachment 123898 [details] Patch Clearing flags on attachment: 123898 Committed r105870: <http://trac.webkit.org/changeset/105870>
All reviewed patches have been landed. Closing bug.