OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardE
vent-repeat" /> |
| 5 <script src="../js/resources/js-test-pre.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 <script> |
| 9 description("Tests KeyboardEvent.repeat attribute"); |
| 10 |
| 11 var lastKeyboardEvent; |
| 12 |
| 13 function recordKeyEvent(ev) { |
| 14 ev = ev || event; |
| 15 ev.keyCode = (ev.which || ev.keyCode); |
| 16 if (window.eventSender) { |
| 17 lastKeyboardEvent = ev; |
| 18 } else { |
| 19 debug("Type=" + ev.type + "," + |
| 20 "keyCode=" + ev.keyCode + ',' + |
| 21 "repeat=" + ev.repeat); |
| 22 } |
| 23 } |
| 24 |
| 25 var textarea = document.createElement("textarea"); |
| 26 textarea.addEventListener("keydown", recordKeyEvent, false); |
| 27 document.body.insertBefore(textarea, document.body.firstChild); |
| 28 textarea.focus(); |
| 29 |
| 30 if (window.eventSender) { |
| 31 eventSender.keyDown("a"); |
| 32 shouldBeFalse("lastKeyboardEvent.repeat"); |
| 33 |
| 34 eventSender.keyDown("a", ["autoRepeat"]); |
| 35 shouldBeTrue("lastKeyboardEvent.repeat"); |
| 36 } |
| 37 </script> |
| 38 <script src="../js/resources/js-test-post.js"></script> |
| 39 </body> |
| 40 </html> |
OLD | NEW |