Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: LayoutTests/fast/events/js-keyboard-event-creation.html

Issue 20986003: Define DOM_KEY_LOCATION_* constants on KeyboardEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script> 3 <script>
4 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
5 function keyevent(event) { 25 function keyevent(event) {
6 var p = document.createElement("p"); 26 var p = document.createElement("p");
7 p.appendChild(document.createTextNode(event.type + " - key: " + event.keyIde ntifier + "@" + event.location + " (keyCode/charCode: " + event.keyCode + "/" + event.charCode + ")" + " modifiers: " + event.ctrlKey + "," + event.altKey + "," + event.shiftKey + "," + event.metaKey)); 27 p.appendChild(document.createTextNode(event.type + " - key: " + event.keyIde ntifier + "@" + keyLocationToText(event.location) + " (keyCode/charCode: " + eve nt.keyCode + "/" + event.charCode + ")" + " modifiers: " + event.ctrlKey + "," + event.altKey + "," + event.shiftKey + "," + event.metaKey));
8 document.getElementById("result").appendChild(p); 28 document.getElementById("result").appendChild(p);
9 } 29 }
10 30
11 function init() { 31 function init() {
12 var input = document.getElementById("testinput"); 32 var input = document.getElementById("testinput");
13 input.addEventListener("keydown", keyevent, true); 33 input.addEventListener("keydown", keyevent, true);
14 input.addEventListener("keypress", keyevent, true); 34 input.addEventListener("keypress", keyevent, true);
15 input.addEventListener("keyup", keyevent, true); 35 input.addEventListener("keyup", keyevent, true);
16 36
17 if (window.testRunner) 37 if (window.testRunner)
(...skipping 11 matching lines...) Expand all
29 <form> 49 <form>
30 <input type="text" size="50" id="testinput" /> 50 <input type="text" size="50" id="testinput" />
31 <input type="text" size="50" /> 51 <input type="text" size="50" />
32 </form> 52 </form>
33 53
34 <p>This tests that DOMKeyboardEvents are created correctly in the JavaScript API.</p> 54 <p>This tests that DOMKeyboardEvents are created correctly in the JavaScript API.</p>
35 55
36 <div id="result"></div> 56 <div id="result"></div>
37 </body> 57 </body>
38 </html> 58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698