blob: 6dce79e697226b7d71f95dea9a80cdd3e92993bf [file] [log] [blame]
<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>