Closed Bug 471741 Opened 16 years ago Closed 16 years ago

Setting selectedIndex to an out-of-bounds value should have the same effect as setting it to -1

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)

Details

(Keywords: html5, testcase)

Attachments

(1 file, 1 obsolete file)

Setting selectedIndex to an out-of-bounds value should have the same effect as setting it to -1. http://www.whatwg.org/specs/web-apps/current-work/#the-select-element/selec/ "The selectedIndex DOM attribute, on getting, must return the index of the first option element in the list of options in tree order that has its selectedness set to true, if any. If there isn't one, then it must return -1. On setting, the selectedIndex attribute must set the selectedness of all the option elements in the list of options to false, and then the option element in the list of options whose index is the given new value, if any, must have its selectedness set to true." This is what Opera 9.51, Safari 3.2.1 and IE8b2 does. Firefox throws an exception: Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMHTMLSelectElement.selectedIndex]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///usr/local/test/selectedIndex.html :: sel :: line 7" data: no]
Attached patch Patch rev. 1 (obsolete) — Splinter Review
Attachment #354997 - Flags: superreview?(roc)
Attachment #354997 - Flags: review?(roc)
Attached patch Patch rev. 2Splinter Review
With slightly updated testcase.
Attachment #354997 - Attachment is obsolete: true
Attachment #354998 - Flags: superreview?(roc)
Attachment #354998 - Flags: review?(roc)
Attachment #354997 - Flags: superreview?(roc)
Attachment #354997 - Flags: review?(roc)
Attachment #354998 - Flags: superreview?(roc)
Attachment #354998 - Flags: superreview+
Attachment #354998 - Flags: review?(roc)
Attachment #354998 - Flags: review+
Status: NEW → RESOLVED
Closed: 16 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: