42 lines
1.3 KiB
HTML
42 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<style>
|
|
#source * {
|
|
color: blue !important;
|
|
font-weight: normal !important;
|
|
}
|
|
body > div {
|
|
border: 2px solid black;
|
|
margin: 10px;
|
|
}
|
|
</style>
|
|
<p id="description">This test ensures copying and paste respects !important in style rules.
|
|
To test manually, copy and paste the content in the first box to the second box. All text should remain in blue and should remain unboldened.</p>
|
|
<div id="source" contenteditable>
|
|
<p>hello <span style="color: red; font-weight: bold;">world</span></p>
|
|
<p><span class="Apple-style-span" style="color: red; font-weight: bold;">WebKit</span></p>
|
|
</div>
|
|
<div id="destination" contenteditable></div>
|
|
<script src="../../resources/dump-as-markup.js"></script>
|
|
<script>
|
|
|
|
Markup.description(document.getElementById('description').textContent);
|
|
|
|
var source = document.getElementById('source');
|
|
source.focus();
|
|
getSelection().selectAllChildren(source);
|
|
|
|
if (document.queryCommandEnabled('paste', false, null) && document.queryCommandEnabled('paste', false, null)) {
|
|
Markup.dump('source', 'Original content');
|
|
document.execCommand('copy');
|
|
getSelection().collapse(document.getElementById('destination'));
|
|
document.execCommand('paste');
|
|
Markup.dump('source', 'Pasted content');
|
|
} else
|
|
Markup.noAutoDump();
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|