6 <p>Tests behavior of code that clears the text from a focused editable div.
7 <br><br>To run manually press any key to clear the text in the div.
<br>The key that was typed should replace the text in the editable div and div should still have the focus and a blinking caret.
</p>
8 <div id=
"it" style=
"-webkit-user-modify: read-write;" onkeydown=
"resetIt(event)" onkeypress=
"typedChar(event)" onkeyup=
"checkResult(event)">text
</div>
9 <p id=
"result">TEST NOT RUN YET
</p>
11 if (window
.testRunner
)
12 testRunner
.dumpAsText();
14 var it
= document
.getElementById("it");
17 function resetIt(event
) {
18 var it
= document
.getElementById("it");
23 var lastTypedChar
= '';
24 function typedChar(event
) {
25 lastTypedChar
= String
.fromCharCode(event
.keyCode
);
28 function checkResult(event
) {
29 if (lastTypedChar
!= '') {
30 var text
= document
.getElementById("it").innerText
;
31 if (text
!= lastTypedChar
)
32 document
.getElementById("result").innerHTML
= "FAIL: editable div content is '" + text
+ "' and it should be '" + lastTypedChar
+ "'" ;
34 document
.getElementById("result").innerHTML
= "PASS";
38 if (window
.eventSender
)
39 eventSender
.keyDown("a");