execCommand insertHTML breaks stored window.getSelection()
问题 When using methods of selecting text and restoring selected text in a page, I have found that running execCommand('insertHTML... inbetween causes the stored selection to break. This is a sample of how the text is selected and restored. // Get Selection var sel = window.getSelection().getRangeAt(0); // Clear Selections window.getSelection().removeAllRanges(); // Restore Selection window.getSelection().addRange(sel) This works fine, however once you run execCommand('insertHTML.. the selections