LayoutTests:
[WebKit-https.git] / LayoutTests / fast / events / js-keyboard-event-creation.html
1 <html>
2 <head>
3 <script>
4
5 function keyevent(event) {
6     var p = document.createElement("p");
7     p.appendChild(document.createTextNode(event.type + " - key: " + event.keyIdentifier + "@" + event.keyLocation + " (keyCode/charCode: " + event.keyCode + "/" + event.charCode + ")" + " modifiers: " + event.ctrlKey + "," + event.altKey + "," + event.shiftKey + "," + event.metaKey));
8     document.getElementById("result").appendChild(p);
9 }
10
11 function init() {
12     var input = document.getElementById("testinput");
13     input.addEventListener("keydown", keyevent, true);
14     input.addEventListener("keypress", keyevent, true);
15     input.addEventListener("keyup", keyevent, true);
16    
17     if (layoutTestController)
18         layoutTestController.dumpAsText();
19     
20     input.focus();
21     if (eventSender) {
22         eventSender.keyDown("\t");
23         eventSender.keyDown("\t", new Array("shiftKey"));
24     }
25 }
26 </script>
27 </head>
28 <body onload="init()">
29     <form>
30         <input type="text" size="50" id="testinput" />
31     </form>
32    
33     <p>This tests that DOMKeyboardEvents are created correctly in the JavaScript API.</p>
34    
35     <div id="result"></div>
36 </body>
37 </html>