Skip to content

Commit

Permalink
fix a crash on exiting FindMode if no queries
Browse files Browse the repository at this point in the history
  • Loading branch information
gdh1995 committed Feb 14, 2020
1 parent fbe4aa5 commit 01b3feb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/dom_utils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,9 @@ DomUtils =
if not node?
return null
if node == sel.anchorNode and sel.focusOffset == sel.anchorOffset
# The selection either *is* an element, or is inside an opaque element (eg. <input>).
node = node.childNodes[sel.focusOffset]
# If the selection is not a caret inside a `#text`, which has no child nodes,
# then it either *is* an element, or is inside an opaque element (eg. <input>).
node = node.childNodes[sel.focusOffset] || node
if node.nodeType != Node.ELEMENT_NODE then node.parentElement else node

# Get the element in the DOM hierachy that contains `element`.
Expand Down

0 comments on commit 01b3feb

Please sign in to comment.