OLD | NEW |
1 <body | 1 <body |
2 onkeypress="log(eventInfo(event))" | 2 onkeypress="log(eventInfo(event))" |
3 onkeydown="log(eventInfo(event))" | 3 onkeydown="log(eventInfo(event))" |
4 onkeyup="log(eventInfo(event))"> | 4 onkeyup="log(eventInfo(event))"> |
5 <p>Test that arrow keys do not dispatch keypress events even if there is no defa
ult handler.</p> | 5 <p>Test that arrow keys do not dispatch keypress events even if there is no defa
ult handler.</p> |
6 <p>To test manually, press arrow keys and verify that no keypress events are log
ged.</p> | 6 <p>To test manually, press arrow keys and verify that no keypress events are log
ged.</p> |
7 <div id="log"></div> | 7 <div id="log"></div> |
8 | 8 |
9 <script> | 9 <script> |
10 function log(msg) { | 10 function log(msg) { |
(...skipping 23 matching lines...) Expand all Loading... |
34 target = event.srcElement ? event.srcElement : event.target; | 34 target = event.srcElement ? event.srcElement : event.target; |
35 if (event.type == "textInput") | 35 if (event.type == "textInput") |
36 return (where ? "(" + where + ") " : "") + target.tagName + " - " + even
t.type + " - " + event.data | 36 return (where ? "(" + where + ") " : "") + target.tagName + " - " + even
t.type + " - " + event.data |
37 + '. Value: "' + target.value + '".'; | 37 + '. Value: "' + target.value + '".'; |
38 else if (event.type == "keydown" || event.type == "keypress" || event.type =
= "keyup") | 38 else if (event.type == "keydown" || event.type == "keypress" || event.type =
= "keyup") |
39 return (where ? "(" + where + ") " : "") + target.tagName | 39 return (where ? "(" + where + ") " : "") + target.tagName |
40 + (target.tagName == "INPUT" ? " " + target.type : "") | 40 + (target.tagName == "INPUT" ? " " + target.type : "") |
41 + " - " + event.type | 41 + " - " + event.type |
42 + ' - ' + [event.ctrlKey, event.altKey, event.shiftKey, event.metaKe
y] | 42 + ' - ' + [event.ctrlKey, event.altKey, event.shiftKey, event.metaKe
y] |
43 + ' - ' + event.keyIdentifier | 43 + ' - ' + event.keyIdentifier |
44 + ' - ' + (event.keyLocation === undefined ? "undefined" : locationN
ame(event.keyLocation)) | 44 + ' - ' + (event.location === undefined ? "undefined" : locationName
(event.location)) |
45 + ' - ' + event.keyCode | 45 + ' - ' + event.keyCode |
46 + ' - ' + event.charCode; | 46 + ' - ' + event.charCode; |
47 | 47 |
48 } catch (ex) { | 48 } catch (ex) { |
49 alert(ex); | 49 alert(ex); |
50 } | 50 } |
51 } | 51 } |
52 log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"] | 52 log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"] |
53 + ' - ' + "keyIdentifier" | 53 + ' - ' + "keyIdentifier" |
54 + ' - ' + "keyLocation" | 54 + ' - ' + "location" |
55 + ' - ' + "keyCode" | 55 + ' - ' + "keyCode" |
56 + ' - ' + "charCode"); | 56 + ' - ' + "charCode"); |
57 | 57 |
58 if (window.testRunner) { | 58 if (window.testRunner) { |
59 testRunner.dumpAsText(); | 59 testRunner.dumpAsText(); |
60 eventSender.keyDown("leftArrow", []); | 60 eventSender.keyDown("leftArrow", []); |
61 } | 61 } |
62 | 62 |
63 </script> | 63 </script> |
64 | 64 |
65 </body> | 65 </body> |
OLD | NEW |