blob: a52349393c5bd35a9545639a14bb9643fed1d331 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
function runTest() {
if (!window.testRunner)
return;
testRunner.dumpAsText();
var element = document.getElementById("test");
window.getSelection().setPosition(element.firstChild, 0);
window.getSelection().modify('extend', 'forward', 'word');
window.getSelection().modify('extend', 'forward', 'word');
window.getSelection().modify('extend', 'forward', 'word');
document.execCommand("Cut");
document.body.style.backgroundColor = "white";
document.execCommand("Paste");
document.body.innerText = document.body.innerHTML;
}
</script>
</head>
<body onLoad="runTest();" contentEditable="true" style="background-color: #bbb;">
<div>
This test verifies that WebKit does not erroneously clone nodes hierarchy when copying text with background color.
To manually this test, select the text inside the div with the border, cut and paste it back. You should not see an additional red border.
<div style="border: 2px solid red">
<div id="test">Select this text</div>
</div>
</div>
</body>
</html>