1 <div id="div1" contentEditable="true">foofoo</div>
2 <div id="div2" contentEditable="true">foofoo</div>
5 if (window.layoutTestController)
6 window.layoutTestController.dumpAsText();
10 // Test 1: Verify that a header at the beginning of inserted content is preserved.
11 div = document.getElementById("div1");
12 text = div.firstChild;
13 window.getSelection().setPosition(text, 3);
14 document.execCommand("InsertHTML", false, "<h1>bar</h1><div>baz</div>");
15 expected = "foo<h1>bar</h1>bazfoo";
16 actual = div.innerHTML;
17 if (actual == expected)
18 output += "Success\n";
20 output += "Failure. Result was: " + actual + ", should have been: " + expected + "\n";
22 // Test 2: Verify that a header at the end of inserted content is preserved.
23 div = document.getElementById("div2");
24 text = div.firstChild;
25 window.getSelection().setPosition(text, 3);
26 document.execCommand("InsertHTML", false, "<div>bar</div><h1>baz</h1>");
27 expected = "foobar<h1>baz</h1>foo";
28 actual = div.innerHTML;
29 if (actual == expected)
30 output += "Success\n";
32 output += "Failure. Result was: " + actual + ", should have been: " + expected + "\n";
34 document.body.innerText = output;