diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-08-31 23:46:29 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-02 11:43:49 -0400 |
commit | c0bf6ff0339c3cdbb4976a6df844c67d50f90835 (patch) | |
tree | 712a3e410d0f3035f52d3b2f0c5a336e7b1b59f0 /ext/fg/js/document.js | |
parent | a2139213c85a0b44e8241f00bca909dd200068e8 (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/fg/js/document.js')
-rw-r--r-- | ext/fg/js/document.js | 5 |
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; |