4 <script type=
"text/javascript">
5 var changeCount
= new Array(4);
6 changeCount
[1] = changeCount
[2] = changeCount
[3] = 0;
10 if (!window
.eventSender
)
13 testRunner
.dumpAsText();
15 var popup
= document
.getElementById("switcher1");
18 popup
= document
.getElementById("switcher2");
21 eventSender
.keyDown("t", null);
22 eventSender
.keyDown("\r", null);
24 var popup
= document
.getElementById("switcher3");
31 setTimeout("document.getElementById('switcher3').selectedIndex = 1;", 0);
33 var popup
= document
.getElementById("switcher2");
36 var result
= document
.getElementById("result");
37 result
.innerHTML
= "";
38 if (changeCount
[1] != 0) {
39 result
.innerHTML
+= "<br/>FAILURE: onchange(1) called " + changeCount
[1] + " times.";
41 if (changeCount
[2] != 1) {
42 result
.innerHTML
+= "<br/>FAILURE: onchange(2) called " + changeCount
[2] + " times.";
44 if (changeCount
[3] != 0) {
45 result
.innerHTML
+= "<br/>FAILURE: onchange(3) called " + changeCount
[3] + " times.";
47 if (result
.innerHTML
== "") result
.innerHTML
= "SUCCESS";
51 function changed(select
)
53 changeCount
[select
]++;
57 <body onload=
"test()">
59 Test for
<i><a href=
"http://bugs.webkit.org/show_bug.cgi?id=23721">http://bugs.webkit.org/show_bug.cgi?id=
23721</a>
60 Changing dropdown's selectedIndex within onchange handler fires another onchange
</i>.
63 To test interactively: focus on the first select (don't change it).
<br/>
64 Change the second select to
"two"<br/>
65 Focus on the third, then click
<a href=
"#" onclick=
"check(); return false;">here
</a>.
67 This select changes on focus: should not fire onchange.
68 <select name=
"switcher1" id=
"switcher1" onfocus=
"this.selectedIndex = 1;" onchange=
"changed(1)">
69 <option value=
"one">One
</option>
70 <option value=
"two">Two
</option>
73 This select changes on change: should only fire onchange once.
74 <select name=
"switcher2" id=
"switcher2" onchange=
"changed(2); if (this.selectedIndex == 1) this.selectedIndex = 2;">
75 <option value=
"one">One
</option>
76 <option value=
"two">Two
</option>
77 <option value=
"three">Three
</option>
80 This select is changed by a timeout in the test script. It should not fire onchange.
81 <select name=
"switcher3" id=
"switcher3" onchange=
"changed(3)">
82 <option value=
"one">One
</option>
83 <option value=
"two">Two
</option>