📅  最后修改于: 2022-03-11 14:47:50.503000             🧑  作者: Mango
selection = window.getSelection(); // Save the selection.
range = document.createRange();
range.selectNodeContents(elem);
selection.removeAllRanges(); // Remove all ranges from the selection.
selection.addRange(range); // Add the new range.