1 <p>To test manually, press keys and compare results to other browsers.
</p>
2 <input type=
"button" value=
"Input"
3 onclick=
"log(eventInfo(event));"
4 onmousedown=
"log(eventInfo(event));"
5 onmouseup=
"log(eventInfo(event));"
6 onkeypress=
"log(eventInfo(event));"
7 onkeydown=
"log(eventInfo(event));"
8 onkeyup=
"log(eventInfo(event));">
14 document
.getElementById("log").innerHTML
+= msg
+ "<br />";
16 function eventInfo(event
, where
) {
20 target
= event
.srcElement
? event
.srcElement
: event
.target
;
21 if (event
.type
== "textInput")
22 return (where
? "(" + where
+ ") " : "") + target
.tagName
+ " - " + event
.type
+ " - " + event
.data
;
23 else if (event
.type
== "keydown" || event
.type
== "keypress" || event
.type
== "keyup")
24 return (where
? "(" + where
+ ") " : "") + target
.tagName
+ " - " + event
.type
25 + ' - ' + [event
.ctrlKey
, event
.altKey
, event
.shiftKey
, event
.metaKey
]
26 + ' - ' + event
.keyIdentifier
27 + ' - ' + event
.keyCode
28 + ' - ' + event
.charCode
;
29 else if (event
.type
== "mousedown" || event
.type
== "click" || event
.type
== "mouseup")
30 return (where
? "(" + where
+ ") " : "") + target
.tagName
+ " - " + event
.type
;
36 log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
37 + ' - ' + "keyIdentifier"
39 + ' - ' + "charCode");
41 if (document
.getElementsByTagName("input")[0].addEventListener
)
42 document
.getElementsByTagName("input")[0].addEventListener('textInput', function(e
) {log(eventInfo(e
));}, false);
44 document
.getElementsByTagName("input")[0].focus();
46 if (window
.testRunner
) {
47 testRunner
.dumpAsText();
49 eventSender
.keyDown(" ", []);
51 eventSender
.keyDown("\r", []);
53 eventSender
.keyDown("A", []);