I cloned a node which contains a selection from a page with deep as true:
const selection = window.getSelection();
let node = selection.getRangeAt(0).commonAncestorContainer;
let clone = node.cloneNode(true);
But the selection is lost and there is no such a method as clone.getSelection()
. I wonder how I can clone the selection from the node? Or how to simulate one on the clone? If it is possible, how can I get it from clone
?