summaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2019-09-22 10:06:52 -0700
committerGitHub <noreply@github.com>2019-09-22 10:06:52 -0700
commitdb405ffd240b8266e6b1585415ed1e90b629bc3e (patch)
tree735590e81fca12c92be5726715585d1ff6c835e5 /ext/fg
parent64eec04a2e7d35a5f94ea568588695f5d0e46c39 (diff)
parent02927f9004132114c975b34491ceb28fb764f2f8 (diff)
Merge pull request #219 from toasted-nutbread/fix-null-caret-position
Handle null return value of document.caretPositionFromPoint
Diffstat (limited to 'ext/fg')
-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;