Когда я использую document.execCommand('copy'), chrome добавляет возврат каретки в конце скопированного текста (которого на самом деле нет в HTLM, а в IE нет (правильное поведение). Я делаю что-то не так?
function copycode(){
var length=this.id.length;
var preid = this.id.substring(0,length-1);
var textnode=document.getElementById(preid);
textnode.setAttribute('contenteditable', 'true');
window.getSelection().removeAllRanges();
var range = document.createRange();
range.selectNode(textnode);
window.getSelection().addRange(range);
var succeed;
try {
succeed = document.execCommand("copy");
}
catch(e) {
succeed = false;
}
textnode.setAttribute('contenteditable', 'false');
}