diff --git a/src/collapsed.js b/src/collapsed.js index 9d47071..d391910 100644 --- a/src/collapsed.js +++ b/src/collapsed.js @@ -11,8 +11,8 @@ function hasSelection(elem) { return ( sel.type === "Range" && (sel.containsNode(elem, true) || - sel.anchorNode.isSelfOrDescendant(elem) || - sel.focusNode.isSelfOrDescendant(elem)) + elem.contains(sel.anchorNode) || + elem.contains(sel.focusNode)) ); }