4 <div id=
"test" contenteditable
><b style=
"font-style: italic;">world
</b></div>
10 testRunner
.dumpAsText();
12 var test
= document
.getElementById('test');
13 window
.getSelection().selectAllChildren(test
);
15 var console
= document
.getElementById('console');
16 var initialValue
= test
.innerHTML
;
18 console
.appendChild(document
.createTextNode('initial:' + test
.innerHTML
+ '\n'));
19 document
.execCommand('bold', false, null);
20 console
.appendChild(document
.createTextNode('after removing bold:' + test
.innerHTML
+ '\n'));
21 document
.execCommand('italic', false, null);
22 console
.appendChild(document
.createTextNode('after removing italic:' + test
.innerHTML
+ '\n'));
23 var finalValue
= test
.innerHTML
;
25 document
.execCommand('undo', false, null);
26 document
.execCommand('undo', false, null);
27 console
.appendChild(document
.createTextNode('after undo:' + test
.innerHTML
+ '\n'));
28 if (test
.innerHTML
!= initialValue
) {
29 console
.appendChild(document
.createTextNode('but expected ' + initialValue
+ '\n'));
32 document
.execCommand('redo', false, null);
33 document
.execCommand('redo', false, null);
34 console
.appendChild(document
.createTextNode('after redo:' + test
.innerHTML
+ '\n'));
35 if (test
.innerHTML
!= finalValue
) {
36 console
.appendChild(document
.createTextNode('but expected ' + finalValue
+ '\n'));
42 console
.appendChild(document
.createTextNode(failed
? 'FAIL\n' : 'PASS\n'));