3 <p>Typing in the input fields below should not generate text, even with an IME enabled.</p>
6 <input type=text id='input'></input><br>
7 <div id='out' style="float: right"></div>
9 <textarea id='area'></textarea><br>
10 Or the contentEditable area:
11 <div contentEditable id='ce' style="border:1px solid red; height:300px; width:300px;"></div>
13 var input = document.getElementById('input');
14 var area = document.getElementById('area');
15 var ce = document.getElementById('ce');
17 var handleKeyDown = function(e) {
18 document.getElementById('out').innerHTML += "<br>Got a key event -- cancelling";
22 input.addEventListener('keydown', handleKeyDown, false);
23 area.addEventListener('keydown', handleKeyDown, false);
24 ce.addEventListener('keydown', handleKeyDown, false);