summaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/document.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index fc8000dd..71a3d7f2 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -195,6 +195,11 @@ function docSentenceExtract(source, extent) {
}
function isPointInRange(x, y, range) {
+ // Require a text node to start
+ if (range.startContainer.nodeType !== Node.TEXT_NODE) {
+ return false;
+ }
+
// Scan forward
const nodePre = range.endContainer;
const offsetPre = range.endOffset;