summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-18 22:11:18 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-18 22:11:18 -0400
commit02927f9004132114c975b34491ceb28fb764f2f8 (patch)
tree7343bb11cb08ad26e2806e2d910140d6af5b2d25
parente3fb9603e22c5cbdc7cdf00b60e8ccbf1c7e2116 (diff)
Handle null return value of document.caretPositionFromPoint
-rw-r--r--ext/fg/js/document.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index 9afc44f0..94a68e6c 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -267,6 +267,9 @@ const caretRangeFromPoint = (() => {
// Firefox
return (x, y) => {
const position = document.caretPositionFromPoint(x, y);
+ if (position === null) {
+ return null;
+ }
const node = position.offsetNode;
if (node === null) {
return null;