Skip to content

Commit

Permalink
fix crash in hasSelection (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock authored Jul 30, 2024
1 parent 63535de commit 45e4722
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/collapsed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
);
}

Expand Down

0 comments on commit 45e4722

Please sign in to comment.