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;