blob: bcb56592daeebc2b4cca789d19ad23989a041018 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body onpaste="finish()">
<p>This tests copying an element with a background color specified in a style rule that conflicts with the background color of a wrapping style.
The pasted text should have lightgreen background color.</p>
<style>
.add { background-color: lightgreen; }
</style>
<div style="background-color: red;">
<div id="target" class='add'>
Copy this line
</div>
<div>some other text</div>
</div>
Paste here:
<div id="destination" contenteditable></div>
<script>
function finish() {
document.body.removeChild(document.querySelector('style'));
document.body.removeChild(target.parentNode);
}
document.body.focus();
var target = document.getElementById('target');
getSelection().setPosition(target, 0);
getSelection().modify('move', 'forward', 'line');
getSelection().modify('move', 'backward', 'lineboundary');
getSelection().modify('extend', 'backward', 'line');
if (window.testRunner) {
document.execCommand('Copy', false, null);
document.getElementById('destination').focus();
document.execCommand('Paste', false, null);
}
</script>
</body>
</html>