click event does not dispatch to parent when child target stops hit testing after...
[WebKit-https.git] / LayoutTests / fast / events / mouse-click-different-mouseDown-mouseUp-nodes.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <style>
6     div {
7         position: absolute;
8         top: 0;
9         left: 0;
10         width: 100%;
11         height: 100%;
12     }
13
14     .button {
15         background-color: blue;
16     }
17
18     .icon {
19         background-color: black;
20     }
21
22     .button:active .icon {
23         transform: scale(0.25);
24     }
25 </style>
26 </head>
27 <body>
28 <div id="parentDiv" class="button" onclick="alert('clicked')">
29     <div id="childDiv" class="icon"></div>
30 </div>
31 <script>
32 description("Tests that the click event is fired at the common ancestor if the mouseDown / mouseUp nodes differ.");
33 jsTestIsAsync = true;
34
35 parentGotClickEvent = false;
36 childGotClickEvent = false;
37
38 document.getElementById("parentDiv").onclick = function() {
39     parentGotClickEvent = true;
40 };
41
42 document.getElementById("childDiv").onclick = function() {
43     childGotClickEvent = true;
44 };
45
46 onload = function() {
47     if (window.eventSender) {
48         eventSender.mouseMoveTo(10, 300);
49         eventSender.mouseDown();
50         eventSender.mouseUp();    
51     }
52
53     setTimeout(function() {
54         shouldBeTrue("parentGotClickEvent");
55         shouldBeFalse("childGotClickEvent");
56         finishJSTest();
57     }, 0);
58 }
59 </script>
60 </body>
61 </html>