📜  selection.addrange() 已弃用 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:50.503000             🧑  作者: Mango

代码示例1
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.