18 lines
617 B
HTML
18 lines
617 B
HTML
<p>This tests for a bug where links that weren't fully selected would be copy/pasted as plain text.</p>
|
|
<div id="copy">This should be plain text. <a id="anchor" href="http://www.google.com/">This should be a link.</a> This should be plain text.</div>
|
|
<div id="paste" contenteditable="true"><br></div>
|
|
|
|
<script>
|
|
var anchor = document.getElementById("anchor");
|
|
var sel = window.getSelection();
|
|
var range = document.createRange();
|
|
range.selectNodeContents(anchor);
|
|
|
|
sel.addRange(range);
|
|
document.execCommand("Copy");
|
|
|
|
var paste = document.getElementById("paste");
|
|
paste.focus();
|
|
document.execCommand("Paste");
|
|
</script>
|