diff options
| -rw-r--r-- | content_scripts/mode_find.coffee | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/content_scripts/mode_find.coffee b/content_scripts/mode_find.coffee index 0fc147a3..950b08e9 100644 --- a/content_scripts/mode_find.coffee +++ b/content_scripts/mode_find.coffee @@ -82,6 +82,7 @@ class FindMode extends Mode FindMode.handleEscape() if event restoreSelection: -> + return unless @initialRange range = @initialRange selection = getSelection() selection.removeAllRanges() @@ -241,7 +242,10 @@ getCurrentRange = -> range else selection.collapseToStart() if selection.type == "Range" - selection.getRangeAt 0 + if selection.rangeCount > 0 + selection.getRangeAt 0 + else # Firefox returns a selection with no ranges and null anchor/focusNode in some situations. + null getLinkFromSelection = -> node = window.getSelection().anchorNode |
