1 <div id=
"description">This tests to make sure that copying and pasting a paragraph or less of content inside a header preserves the header element. To run it manually, Paste, then inspect the pasted content and verify that it's in an H1 element.
</div>
2 <div id=
"copy"><h1>foo
</h1></div>
3 <div id=
"paste" contentEditable=
"true"></div>
8 window
.testRunner
.dumpAsText();
10 // Test 2: Verify that a header at the end of inserted content is preserved.
11 copy
= document
.getElementById("copy");
12 window
.getSelection().setBaseAndExtent(copy
, 0, copy
, copy
.childNodes
.length
);
13 document
.execCommand("Copy");
15 paste
= document
.getElementById("paste");
16 window
.getSelection().collapse(paste
, 0);
17 document
.execCommand("Paste");
19 expected
= "<h1>foo</h1>";
20 actual
= paste
.innerHTML
;
22 if (window
.testRunner
&& actual
== expected
)
23 document
.body
.innerText
= "Success";
25 document
.body
.innerText
= "Failure. Found: " + actual
+ ", but expected: " + expected
;