Bug 119722

Summary: NodeList.item() does not behave according to specification
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, cdumez, commit-queue, esprehn+autocc, ggaren, kangil.han, kling, koivisto, kondapallykalyan, oliver, syoichi
Priority: P2 Keywords: BlinkMergeCandidate, WebExposed
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
darin: review+, commit-queue: commit-queue-
Patch for landing none

Description Ryosuke Niwa 2013-08-12 20:52:48 PDT
NodeList.item() does not behave according to specification:
http://dom.spec.whatwg.org/#nodelist

Namely, we should not throw if the index is negative (meaning we should
drop the [IsIndex] extended attribute) and the argument should be
mandatory.

This behavior is consistent with both IE10 and Firefox.

http://crbug.com/237739
Comment 1 Ryosuke Niwa 2013-08-12 20:53:20 PDT
https://chromium.googlesource.com/chromium/blink/+/772a8f92ccdcf997ebfbbcf185132a050e8132aa

Also see https://chromium.googlesource.com/chromium/blink/+/33a9622c83dd9d85a7bd91b936bb2a31bd34f74b

HTMLSelectElement.item() does not behave according to specification

HTMLSelectElement.item() does not behave according to specification:
http://www.w3.org/TR/html51/forms.html#dom-select-item
http://dom.spec.whatwg.org/#dom-htmlcollection-item

Namely, we should not throw if the offset argument is negative. Also,
the argument should be mandatory.

IE10 and Firefox do not throw when HTMLSelectElement.item() is called
with a negative value (as per the specification).

The argument is mandatory in Firefox but optional in IE10 (it returns
null when called without argument). This looks like a bug in IE because
other item() getters' argument is usually mandatory in IE (e.g.
NodeList.item()).
Comment 2 Chris Dumez 2013-08-13 03:18:58 PDT
Created attachment 208613 [details]
Patch
Comment 3 WebKit Commit Bot 2013-08-13 09:14:53 PDT
Comment on attachment 208613 [details]
Patch

Rejecting attachment 208613 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-03', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 208613, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
/git.webkit.org/WebKit
   9081187..7340ea8  master     -> origin/master
Partial-rebuilding .git/svn/refs/remotes/origin/master/.rev_map.268f45cc-cd09-0410-ab3c-d52691b4dbfc ...
Currently at 154002 = 9081187b8639b6f28cfbdabe2544c85eac8cf3cb
r154003 = 7340ea89c2ddbcae7bef8b4b5870187f14bec550
Done rebuilding .git/svn/refs/remotes/origin/master/.rev_map.268f45cc-cd09-0410-ab3c-d52691b4dbfc
First, rewinding head to replay your work on top of it...
Fast-forwarded master to refs/remotes/origin/master.

Full output: http://webkit-queues.appspot.com/results/1447645
Comment 4 Chris Dumez 2013-08-13 09:46:16 PDT
Created attachment 208645 [details]
Patch for landing
Comment 5 WebKit Commit Bot 2013-08-13 10:57:46 PDT
Comment on attachment 208645 [details]
Patch for landing

Clearing flags on attachment: 208645

Committed r154012: <http://trac.webkit.org/changeset/154012>
Comment 6 WebKit Commit Bot 2013-08-13 10:57:50 PDT
All reviewed patches have been landed.  Closing bug.