代码

window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();