+2006-08-11 Adele Peterson <adele@apple.com>
+
+ Reviewed by Brady.
+
+ Test case for <rdar://problem/4656274>
+ REGRESSION: option elements are selected when added regardless of "selected" property
+
+ * fast/forms/option-constructor-selected-expected.txt: Added.
+ * fast/forms/option-constructor-selected.html: Added.
+
2006-08-08 Rob Buis <buis@kde.org>
Reviewed by Darin.
--- /dev/null
+This tests that the "selected" argument is honored when constructing an option element.
+
+Test 0 Passed: the selected index is 0.
+Test 1 Passed: the selected index is 0.
+Test 2 Passed: the selected index is 0.
+Test 3 Passed: the selected index is 3.
+Test 4 Passed: the selected index is 4.
+Test 5 Passed: the selected index is 4.
+
--- /dev/null
+<html>
+<script>
+ function test() {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var popup = document.getElementById('popup');
+ var success;
+
+ // Test 0
+ popup.options[0] = new Option ( "option0", "0" );
+ if (popup.selectedIndex == 0)
+ success = "Passed";
+ else
+ success = "Failed";
+ log("Test 0 " + success + ": the selected index is " + popup.selectedIndex + ".");
+
+
+ // Test 1
+ popup.options[1] = new Option ( "option1", "1" , false, false);
+ if (popup.selectedIndex == 0)
+ success = "Passed";
+ else
+ success = "Failed";
+ log("Test 1 " + success + ": the selected index is " + popup.selectedIndex + ".");
+
+ // Test 2
+ popup.options[2] = new Option ( "option2", "2", true, false );
+ if (popup.selectedIndex == 0)
+ success = "Passed";
+ else
+ success = "Failed";
+ log("Test 2 " + success + ": the selected index is " + popup.selectedIndex + ".");
+
+ // Test 3
+ popup.options[3] = new Option ( "option3", "3", false, true );
+ if (popup.selectedIndex == 3)
+ success = "Passed";
+ else
+ success = "Failed";
+ log("Test 3 " + success + ": the selected index is " + popup.selectedIndex + ".");
+
+ // Test 4
+ popup.options[4] = new Option ( "option4", "4", true, true );
+ if (popup.selectedIndex == 4)
+ success = "Passed";
+ else
+ success = "Failed";
+ log("Test 4 " + success + ": the selected index is " + popup.selectedIndex + ".");
+
+ // Test 5
+ popup.options[5] = new Option ( "option5", "5");
+ if (popup.selectedIndex == 4)
+ success = "Passed";
+ else
+ success = "Failed";
+ log("Test 5 " + success + ": the selected index is " + popup.selectedIndex + ".");
+ }
+
+ function log(msg) {
+ var console = document.getElementById('console');
+ console.innerHTML = console.innerHTML + msg + "<br>";
+ }
+</script>
+<body onload="test()">
+ This tests that the "selected" argument is honored when constructing an option element.<br>
+ <select id="popup"></select><br>
+ <div id="console"></div>
+</body>
+</html>
\ No newline at end of file
+2006-08-11 Adele Peterson <adele@apple.com>
+
+ Reviewed by Brady.
+
+ - Fix for <rdar://problem/4656274>
+ REGRESSION: option elements are selected when added regardless of "selected" property
+
+ Test: fast/forms/option-constructor-selected.html
+
+ * html/HTMLSelectElement.cpp: (WebCore::HTMLSelectElement::setOption):
+ When adding an option element, check that the option element is selected before calling setSelectedIndex.
+
2006-08-11 David Hyatt <hyatt@apple.com>
Fix for bug 10349, make sure to call setChanged when an anchor changes