aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-09-19 23:05:17 -0700
committerAlex Yatskov <alex@foosoft.net>2017-09-19 23:05:17 -0700
commit0554aa0d275dd989260ec8e426f35f946074c674 (patch)
tree3a51d69bf4b6ac4a40673bc815ae284e8b0c9889 /ext/fg/js
parente90274519a57d43e77e864ed3259d1b6c73654be (diff)
make sure ranges are created over text nodes only (fixes #80)
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/document.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index b1e71777..a1806d77 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -86,7 +86,7 @@ function docRangeFromPoint(point) {
}
const range = document.caretRangeFromPoint(point.x, point.y);
- if (range) {
+ if (range && range.startContainer.nodeType === 3 && range.endContainer.nodeType === 3) {
return new TextSourceRange(range);
}
}