3 <p>This tests inserting a new paragraph preserves the background color.
</p>
5 <div id=
"test" contenteditable=
"true">
9 <div id=
"console"></div>
11 <script type=
"text/javascript">
13 function pressKey( key
) {
14 if (window
.KeyEvent
) {
15 var ev
= document
.createEvent("KeyboardEvent");
16 ev
.initKeyEvent("keypress", true, true, window
, 0,0,0,0, 0, key
.charCodeAt(0));
17 document
.body
.dispatchEvent(ev
);
20 var ev
= document
.createEvent("TextEvent");
21 ev
.initTextEvent('textInput', true, true, null, key
.charAt(0));
22 document
.body
.dispatchEvent(ev
);
26 if (window
.testRunner
)
27 testRunner
.dumpAsText();
29 var e
= document
.getElementById('test');
30 var s
= window
.getSelection();
32 r
= document
.createRange();
33 r
.setStart(e
.firstChild
,0);
34 r
.setEnd(e
.firstChild
,5);
37 document
.execCommand("hiliteColor",false,"#99f");
39 r
= document
.createRange();
40 r
.setStart(e
.firstChild
.firstChild
,5);
41 r
.setEnd(e
.firstChild
.firstChild
,5);
47 document
.getElementById('console').appendChild(document
.createTextNode(e
.innerHTML
));