1 <body onload=
"setup()">
2 <p>cmd+b and cmd+i should generate a keydown event in contentEditable fields. Also, calling
3 preventDefault() in the keydown event should cancel the text styling.
</p>
5 <div contentEditable
id=
"test" style=
"border: 1px solid; padding: 4px;">
6 This is some sample text.
<br><br><br><br>
9 <input type=
"checkbox" id=
"disable"><label for=
"disable">preventDefault() in keydown
</label>
16 var test
= document
.getElementById("test");
17 test
.addEventListener("keydown", keydown
, false);
19 var selection
= window
.getSelection();
20 selection
.setPosition(test
, 0);
21 selection
.modify("extend", "forward", "sentence");
27 var log
= document
.getElementById("log");
28 log
.innerHTML
+= "<br>" + msg
;
31 function keydown(event
)
34 if (document
.getElementById("disable").checked
)
35 event
.preventDefault();