Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / style / highlight-insert-paragraph.html
blobe9c0ca01811b5f3a5e5d0053e4ede76adac95dba
1 <html>
2 <body>
3 <p>This tests inserting a new paragraph preserves the background color.</p>
4 <div>
5 <div id="test" contenteditable="true">
6 test
7 </div>
8 </div>
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);
19 else {
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);
35 s.removeAllRanges();
36 s.addRange(r);
37 document.execCommand("hiliteColor",false,"#99f");
39 r = document.createRange();
40 r.setStart(e.firstChild.firstChild,5);
41 r.setEnd(e.firstChild.firstChild,5);
42 s.removeAllRanges();
43 s.addRange(r);
44 pressKey('\n');
45 pressKey('e');
47 document.getElementById('console').appendChild(document.createTextNode(e.innerHTML));
49 </script>