aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-08-31 23:46:29 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-02 11:43:49 -0400
commitc0bf6ff0339c3cdbb4976a6df844c67d50f90835 (patch)
tree712a3e410d0f3035f52d3b2f0c5a336e7b1b59f0 /ext
parenta2139213c85a0b44e8241f00bca909dd200068e8 (diff)
Fix issues caused by scanning ranges which don't start with a text node
The rects returned by range.getClientRects() could include the entire start element's bounding box.
Diffstat (limited to 'ext')
-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;