WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
74468
Incorrect behavior for HTMLCollection.prototype.item(someString)
https://bugs.webkit.org/show_bug.cgi?id=74468
Summary
Incorrect behavior for HTMLCollection.prototype.item(someString)
Boris Zbarsky
Reported
2011-12-13 17:29:47 PST
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.
Attachments
Testcase
(441 bytes, text/html)
2011-12-13 17:29 PST
,
Boris Zbarsky
no flags
Details
Patch
(11.72 KB, patch)
2012-01-25 01:29 PST
,
Pablo Flouret
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2011-12-14 10:54:06 PST
> 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().
Boris Zbarsky
Comment 2
2011-12-14 11:06:24 PST
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.
Boris Zbarsky
Comment 3
2011-12-14 11:08:07 PST
I filed
https://www.w3.org/Bugs/Public/show_bug.cgi?id=15184
Ryosuke Niwa
Comment 4
2011-12-14 16:00:57 PST
***
Bug 74546
has been marked as a duplicate of this bug. ***
Pablo Flouret
Comment 5
2012-01-25 01:29:33 PST
Created
attachment 123898
[details]
Patch
Adam Barth
Comment 6
2012-01-25 01:35:22 PST
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?
Adam Barth
Comment 7
2012-01-25 01:36:04 PST
Comment on
attachment 123898
[details]
Patch Ah, I see that Alexey answered that question above.
WebKit Review Bot
Comment 8
2012-01-25 05:04:40 PST
Comment on
attachment 123898
[details]
Patch Clearing flags on attachment: 123898 Committed
r105870
: <
http://trac.webkit.org/changeset/105870
>
WebKit Review Bot
Comment 9
2012-01-25 05:04:49 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug