blob: ba7dd0e81828e10dcb43ff6f978ae15e72d27ec2 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
div { border: solid 1px; padding: 5px; margin: 5px; width: 20ex; }
.red { color: red; font-size: x-large; }
blockquote { margin: 0px; padding: 0px 0px 0px 2ex; border-left: solid 2px #06f; }
#copy em { font-style: normal; font-weight: bold; color: yellow; }
#container p { padding: 0px; margin: 1em 0px 1em 0px; background-color: blue;}
</style>
</head>
<body>
<p>This test ensures WebKit does not duplicate styles from matched rules in inline style declarations when copying and pasting contents.
To manually test, copy "hello world WebKit" and paste it in the box blow.
Each element should have exact properties stated in its title attribute</p>
<section id="container">
<div id="copy" contenteditable><blockquote title="none">hello</blockquote>
<p title="none"><span class="red" style="font-size: 1em; font-weight: bold;" title="font-size: 1em; font-weight: bold;">world</span>
<em style="color: blue;" title="font-weight: bold; color: blue;">WebKit</em></p></div>
<div id="paste" contenteditable></div>
</section>
<script src="../../resources/dump-as-markup.js"></script>
<script>
Markup.description(document.getElementsByTagName('p')[0].textContent);
Markup.dump('copy', 'Original');
document.getElementById('copy').focus();
document.execCommand('SelectAll', false, null);
function dump() { Markup.dump('paste', 'Pasted'); }
if (window.testRunner) {
document.execCommand('Copy', false, null);
document.getElementById('paste').focus();
document.execCommand('Paste', false, null);
dump();
document.getElementById('container').style.display = 'none';
} else
document.getElementById('paste').addEventListener('paste', function () { setTimeout(dump, 0); }, false);
</script>
</body>
</html>