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

Side by Side Diff: LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.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: address bokan's feedback Created 5 years, 9 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <select id='top'></select>
9 <pre id="console"></pre>
10 <script>
11 description("Tests to ensure that default action does not occur.");
12
13 function focusHandler() {
14 testFailed('default action should not occur.');
15 }
16
17 function test()
18 {
19 if (window.testRunner)
20 testRunner.dumpAsText();
21
22 var node = document.getElementById('top');
23 node.addEventListener('focus', focusHandler, false);
Rick Byers 2015/03/05 16:34:18 as an extra sanity check that your test is functio
24 var client = node.getBoundingClientRect();
25
26 var event = document.createEvent("MouseEvents");
Rick Byers 2015/03/05 16:34:18 nit: might as well use the constructor syntax (new
27 event.initMouseEvent("mousedown", true, false, window,
28 0, client.left, client.top, client.left, client.top, fa lse, false, false, false, 0, null);
29 node.dispatchEvent(event);
30 }
31
32 test();
33 </script>
34 </body>
35 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698