2 onkeypress=
"log(eventInfo(event))"
3 onkeydown=
"log(eventInfo(event))"
4 onkeyup=
"log(eventInfo(event))">
5 <p>Test that arrow keys do not dispatch keypress events even if there is no default handler.
</p>
6 <p>To test manually, press arrow keys and verify that no keypress events are logged.
</p>
11 document
.getElementById("log").innerHTML
+= msg
+ "<br />";
15 function locationName(code
) {
18 return "DOM_KEY_LOCATION_STANDARD";
20 return "DOM_KEY_LOCATION_LEFT";
22 return "DOM_KEY_LOCATION_RIGHT";
24 return "DOM_KEY_LOCATION_NUMPAD";
26 return code
.toString();
30 function eventInfo(event
, where
) {
34 target
= event
.srcElement
? event
.srcElement
: event
.target
;
35 if (event
.type
== "textInput")
36 return (where
? "(" + where
+ ") " : "") + target
.tagName
+ " - " + event
.type
+ " - " + event
.data
37 + '. Value: "' + target
.value
+ '".';
38 else if (event
.type
== "keydown" || event
.type
== "keypress" || event
.type
== "keyup")
39 return (where
? "(" + where
+ ") " : "") + target
.tagName
40 + (target
.tagName
== "INPUT" ? " " + target
.type
: "")
42 + ' - ' + [event
.ctrlKey
, event
.altKey
, event
.shiftKey
, event
.metaKey
]
43 + ' - ' + event
.keyIdentifier
44 + ' - ' + (event
.location
=== undefined ? "undefined" : locationName(event
.location
))
45 + ' - ' + event
.keyCode
46 + ' - ' + event
.charCode
;
52 log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
53 + ' - ' + "keyIdentifier"
56 + ' - ' + "charCode");
58 if (window
.testRunner
) {
59 testRunner
.dumpAsText();
60 eventSender
.keyDown("leftArrow", []);