Remove NavigatorBase::serviceWorkerIfExists
[WebKit-https.git] / LayoutTests / fast / events / js-keyboard-event-creation.html
1 <html>
2 <head>
3 <script>
4
5 function keyLocationToText(location)
6 {
7     switch (location) {
8         case KeyboardEvent.DOM_KEY_LOCATION_STANDARD:
9             return "DOM_KEY_LOCATION_STANDARD";
10         case KeyboardEvent.DOM_KEY_LOCATION_LEFT:
11             return "DOM_KEY_LOCATION_LEFT";
12         case KeyboardEvent.DOM_KEY_LOCATION_RIGHT:
13             return "DOM_KEY_LOCATION_RIGHT";
14         case KeyboardEvent.DOM_KEY_LOCATION_NUMPAD:
15             return "DOM_KEY_LOCATION_NUMPAD";
16         case KeyboardEvent.DOM_KEY_LOCATION_MOBILE:
17             return "DOM_KEY_LOCATION_MOBILE";
18         case KeyboardEvent.DOM_KEY_LOCATION_JOYSTICK:
19             return "DOM_KEY_LOCATION_JOYSTICK";
20         default:
21             return "" + location
22     }
23 }
24
25 function keyevent(event) {
26     var p = document.createElement("p");
27     p.appendChild(document.createTextNode(event.type + " - key: " + event.keyIdentifier + "@" + keyLocationToText(event.location) + " (keyCode/charCode: " + event.keyCode + "/" + event.charCode + ")" + " modifiers: " + event.ctrlKey + "," + event.altKey + "," + event.shiftKey + "," + event.metaKey));
28     document.getElementById("result").appendChild(p);
29 }
30
31 function init() {
32     var input = document.getElementById("testinput");
33     input.addEventListener("keydown", keyevent, true);
34     input.addEventListener("keypress", keyevent, true);
35     input.addEventListener("keyup", keyevent, true);
36    
37     if (window.testRunner)
38         testRunner.dumpAsText();
39     
40     input.focus();
41     if (window.eventSender) {
42         eventSender.keyDown("\t");
43         eventSender.keyDown("\t", new Array("shiftKey"));
44     }
45 }
46 </script>
47 </head>
48 <body onload="init()">
49     <form>
50         <input type="text" size="50" id="testinput" />
51         <input type="text" size="50" />
52     </form>
53    
54     <p>This tests that DOMKeyboardEvents are created correctly in the JavaScript API.</p>
55    
56     <div id="result"></div>
57 </body>
58 </html>