Don't include ApplicationServices in npapi.h
[WebKit-https.git] / LayoutTests / fast / events / domactivate-sets-underlying-click-event-as-handled.html
1 <!DOCTYPE html>
2 To test manually, click on all the form elements (except the textbox) and the details/summary
3 element. The anchor shouldn't be activated (i.e. you shouldn't see any "anchor activated" messages).
4 <a href="javascript:anchorActivated()">
5     <form action="javascript:formSubmitted()">
6         <input type=text>
7         <input type=submit>
8         <input type=image>
9         <button>button</button>
10         <input type=reset>
11         <button type=reset>button reset</button>
12         <input type=checkbox>
13         <input type=radio>
14         <input type=file>
15         </form>
16     <details><summary>summary</summary>details</details>
17 </a>
18
19 <pre>
20
21 </pre>
22
23 <script>
24 if (window.testRunner)
25     testRunner.dumpAsText();
26
27 function log(message) { document.querySelector("pre").innerHTML += message + "\n"; }
28 function formSubmitted() { log("form submitted\n"); }
29 function anchorActivated() { log("anchor activated\n"); }
30
31 document.forms[0].children[0].value = "blah";
32
33 for (var i=0; i < document.forms[0].children.length; i++) {
34     var element = document.forms[0].children[i];
35
36     element.addEventListener("click", function () {
37         log("Activated " + this + " type=" + this.type);
38     }, false);
39
40     if (!window.eventSender)
41         continue;
42
43     if (element.type == "text") {
44         log("Focusing " + element + " type=" + element.type + " and pressing enter");
45         element.focus();
46         eventSender.keyDown("\n");
47         continue;
48     }
49
50     eventSender.mouseMoveTo(element.offsetLeft + element.clientWidth / 2, element.offsetTop + element.clientHeight / 2);
51     eventSender.mouseDown();
52     eventSender.mouseUp();
53
54     if (element.type == "radio" || element.type == "checkbox")
55         continue;
56
57     log("Focusing " + element + " type=" + element.type + " and pressing enter");
58     element.focus();
59     eventSender.keyDown("\n");
60 }
61
62 if (window.eventSender) {
63     var details = document.querySelector("details");
64     eventSender.mouseMoveTo(details.offsetLeft + details.clientWidth / 2, details.offsetTop + details.clientHeight / 2);
65     eventSender.mouseDown();
66     eventSender.mouseUp();
67     log("\nThe details element was " + (details.open ? "" : "not ") + "opened");
68 }
69
70 if (window.testRunner)
71     document.querySelector("a").style.display = "none";
72 </script>