Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: LayoutTests/fast/forms/select-list-box-mouse-focus.html

Issue 894913002: Prevent default actions for JS-generated mouse events other than click (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: TIL, gclient sync may rebase changes back in time Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 x = select.clientLeft + 10; 7 var rect = select.getBoundingClientRect();
8 var y = select.clientTop + 10; 8 var x = rect.left + 10;
9 var event = document.createEvent("MouseEvent"); 9 var y = rect.top + 10;
10 event.initMouseEvent("mousedown", true, true, document.defaultView, 1, x, y, x, y, false, false, false, false, 0, document); 10
11 select.dispatchEvent(event); 11 if (!eventSender) {
12 alert('Click the select to run the test.');
13 return;
14 }
15
16 eventSender.mouseMoveTo(x, y);
17 eventSender.mouseDown(0);
12 } 18 }
13 function reportFocus() 19 function reportFocus()
14 { 20 {
15 document.getElementById("result").innerHTML = "PASS"; 21 document.getElementById("result").innerHTML = "PASS";
16 } 22 }
17 </script> 23 </script>
18 <body onload="test()"> 24 <body onload="test()">
19 <p>The select below should be focused because we dispatched a mouse down event t o it.</p> 25 <p>The select below should be focused once clicked.</p>
20 <p id="result">FAIL</p> 26 <p id="result">FAIL</p>
21 <select id="select" size="4" onfocus="reportFocus()"> 27 <select id="select" size="4" onfocus="reportFocus()">
22 <option>one</option> 28 <option>one</option>
23 <option>two</option> 29 <option>two</option>
24 <option>three</option> 30 <option>three</option>
25 <option>four</option> 31 <option>four</option>
26 </select> 32 </select>
27 </body> 33 </body>
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/range/slider-zoomed.html ('k') | LayoutTests/fast/forms/select-list-box-mouse-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698