<!DOCTYPE html>
<html> 
<body>
<p>This test verifies that WebKit does not erroneously clone nodes hierarchy when copying text with background color.
"Hello" should be blue and has yellow background but you should not see red border.</p>
<p>To manually this test, copy "Hello" and paste it on the black box below.</p>
<div style="padding: 10px;"><span style="color: blue; background-color: yellow; padding: 5px;"><div><span style="border: 2px solid red; border-radius: 15px;">
<span id="source">Hello</span>
</span></div></span></div>
<div id="destination" style="border: solid 1px black; padding: 20px;" contenteditable></div>
<script src="../../resources/dump-as-markup.js"></script>
<script>

if (window.testRunner) {
    window.getSelection().setBaseAndExtent(document.getElementById('source'), 0, document.getElementById('source'), 1);
    document.execCommand("Copy");

    window.getSelection().setPosition(document.getElementById('destination'), 0);
    document.execCommand("Paste");

    Markup.description(document.getElementsByTagName('p')[0].textContent);
    Markup.dump('destination', 'You should not see any borders');
} else
    Markup.noAutoDump();

</script>
</body>
</html>
