blob: f189548d8a2be3f17aa7d4a55331ffa09260267b [file] [log] [blame]
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
</script>
<p>This tests for a bug when creating markup for a selection that contained unrendered nodes with children. You should see a picture of abe followed by a select box.</p>
<div id="paste" contenteditable="true"></div>
<img id="start" src="../resources/abe.png">
<select id="end"><optgroup><option>1</option><option>2</option><option>3</option></optgroup></select>
</select>
<script>
function runTest() {
var start = document.getElementById("start");
var end = document.getElementById("end");
var s = window.getSelection();
s.setBaseAndExtent(start, 0, end, end.childNodes.length);
document.execCommand("Copy");
s.setPosition(document.getElementById("paste"), 0);
document.execCommand("Paste");
const pastedImageElement = document.querySelector('#paste img');
if (pastedImageElement.complete)
finish();
else
pastedImageElement.onload = finish;
}
function finish() {
if (window.testRunner)
window.testRunner.notifyDone();
}
if (window.testRunner)
window.testRunner.waitUntilDone();
window.onload = runTest;
</script>