Changeset 104864 in webkit
- Timestamp:
- Jan 12, 2012 2:57:14 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r104851 r104864 1 2012-01-12 Jon Lee <jonlee@apple.com> 2 3 Setting value on a select element to a non existing option value should clear selection 4 https://bugs.webkit.org/show_bug.cgi?id=67233 5 <rdar://problem/10057159> 6 7 Reviewed by Darin Adler. 8 9 New tests check to see that setting the value of a select element clears the 10 selection, even if the value is invalid, null, or undefined. 11 12 * fast/forms/select/setting-to-invalid-value-expected.txt: Added. 13 * fast/forms/select/setting-to-invalid-value.html: Added. 14 1 15 2012-01-12 Simon Fraser <simon.fraser@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r104863 r104864 1 2012-01-12 Jon Lee <jonlee@apple.com> 2 3 Setting value on a select element to a non existing option value should clear selection 4 https://bugs.webkit.org/show_bug.cgi?id=67233 5 <rdar://problem/10057159> 6 7 Reviewed by Darin Adler. 8 9 Test: fast/forms/select/setting-to-invalid-value.html 10 11 * html/HTMLSelectElement.cpp: 12 (WebCore::HTMLSelectElement::setValue): Clear the selection in the cases where we cannot 13 find an option with the specified value. The spec states to clear the selectedness of all 14 options first. To avoid calling setSelectedIndex() multiple times, we clear the selected 15 option(s) only when don't find the appropriate option. 16 17 Also, correct the sentence style of a comment. 18 1 19 2012-01-12 Jer Noble <jer.noble@apple.com> 2 20 -
trunk/Source/WebCore/html/HTMLSelectElement.cpp
r104383 r104864 248 248 void HTMLSelectElement::setValue(const String &value) 249 249 { 250 if (value.isNull()) 250 // We clear the previously selected option(s) when needed, to guarantee calling setSelectedIndex() only once. 251 if (value.isNull()) { 252 setSelectedIndex(-1); 251 253 return; 252 // find the option with value() matching the given parameter 253 // and make it the current selection. 254 } 255 256 // Find the option with value() matching the given parameter and make it the current selection. 254 257 const Vector<HTMLElement*>& items = listItems(); 255 258 unsigned optionIndex = 0; … … 263 266 } 264 267 } 268 269 setSelectedIndex(-1); 265 270 } 266 271
Note: See TracChangeset
for help on using the changeset viewer.