OLD | NEW |
1 <script> | 1 <script> |
2 function test() | 2 function test() |
3 { | 3 { |
4 if (window.testRunner) | 4 if (window.testRunner) |
5 testRunner.dumpAsText(); | 5 testRunner.dumpAsText(); |
6 var select = document.getElementById("select"); | 6 var select = document.getElementById("select"); |
7 var rect = select.getBoundingClientRect(); | 7 var x = select.clientLeft + 10; |
8 var x = rect.left + 10; | 8 var y = select.clientTop + 10; |
9 var y = rect.top + 10; | 9 var event = document.createEvent("MouseEvent"); |
10 | 10 event.initMouseEvent("mousedown", true, true, document.defaultView, 1, x, y,
x, y, false, false, false, false, 0, document); |
11 if (window.eventSender) { | 11 select.dispatchEvent(event); |
12 eventSender.mouseMoveTo(x, y); | |
13 eventSender.mouseDown(0); | |
14 } | |
15 } | 12 } |
16 function reportFocus() | 13 function reportFocus() |
17 { | 14 { |
18 document.getElementById("result").innerHTML = "PASS"; | 15 document.getElementById("result").innerHTML = "PASS"; |
19 } | 16 } |
20 </script> | 17 </script> |
21 <body onload="test()"> | 18 <body onload="test()"> |
22 <p>The select below should be focused because we dispatched a mouse down event t
o it.</p> | 19 <p>The select below should be focused because we dispatched a mouse down event t
o it.</p> |
23 <p id="result">FAIL</p> | 20 <p id="result">FAIL</p> |
24 <select id="select" size="4" onfocus="reportFocus()"> | 21 <select id="select" size="4" onfocus="reportFocus()"> |
25 <option>one</option> | 22 <option>one</option> |
26 <option>two</option> | 23 <option>two</option> |
27 <option>three</option> | 24 <option>three</option> |
28 <option>four</option> | 25 <option>four</option> |
29 </select> | 26 </select> |
30 </body> | 27 </body> |
OLD | NEW |