3 This tests applying a background color at the beginning, the middle and the end of one sentence, then undo and redo.
5 <a href=
"https://bugs.webkit.org/show_bug.cgi?id=30892">Bug
30892</a>
7 <div contenteditable=
"true">
8 <div id=
"test1">Hello!
</div>
9 <div id=
"test2">Hello!
</div>
10 <div id=
"test3">Hello!
</div>
14 <li>Test
1:
<span id=
"c1"></span></li>
15 <li>Test
2:
<span id=
"c2"></span></li>
16 <li>Test
3:
<span id=
"c3"></span></li>
19 <script type=
"text/javascript">
20 function runTest(elem
, node
)
22 var e
= document
.getElementById(node
);
23 var before
= e
.innerHTML
;
24 document
.execCommand("hilitecolor", false, "#FF0000");
25 var after
= e
.innerHTML
;
26 document
.execCommand("undo");
27 var afterundo
= e
.innerHTML
;
28 document
.execCommand("redo");
30 document
.getElementById(elem
).appendChild(document
.createTextNode(((before
== afterundo
) && (after
== e
.innerHTML
))? "PASSED": "FAILED"));
33 if (window
.testRunner
) {
34 testRunner
.dumpEditingCallbacks();
35 testRunner
.dumpAsText();
38 var s
= window
.getSelection();
39 s
.setBaseAndExtent(document
.getElementById('test1').firstChild
, 0, document
.getElementById('test1').firstChild
, 2);
40 runTest('c1', 'test1');
41 s
.setBaseAndExtent(document
.getElementById('test2').firstChild
, 2, document
.getElementById('test2').firstChild
, 4);
42 runTest('c2', 'test2');
43 s
.setBaseAndExtent(document
.getElementById('test3').firstChild
, 4, document
.getElementById('test3').firstChild
, 6);
44 runTest('c3', 'test3');