summaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-11-04 08:18:49 -0700
committerAlex Yatskov <alex@foosoft.net>2017-11-04 08:18:49 -0700
commitd505edb94b27ecd8cbaaecd11cbebfbe12b16164 (patch)
tree44ab656f33f7eedb0e4e0c9e31e0ccceffb069e0 /ext/fg
parent5c0d1cc6dae358dd2c04bdaac8f30cebfad5466d (diff)
parentdcef7ce3774a3dcc8e7bee0bc17398251523451e (diff)
Merge branch 'dev'
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/document.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index a1806d77..821a279f 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -76,7 +76,7 @@ function docRangeFromPoint(point) {
if (!document.caretRangeFromPoint) {
document.caretRangeFromPoint = (x, y) => {
const position = document.caretPositionFromPoint(x,y);
- if (position && position.offsetNode) {
+ if (position && position.offsetNode && position.offsetNode.nodeType === Node.TEXT_NODE) {
const range = document.createRange();
range.setStart(position.offsetNode, position.offset);
range.setEnd(position.offsetNode, position.offset);
@@ -86,7 +86,7 @@ function docRangeFromPoint(point) {
}
const range = document.caretRangeFromPoint(point.x, point.y);
- if (range && range.startContainer.nodeType === 3 && range.endContainer.nodeType === 3) {
+ if (range) {
return new TextSourceRange(range);
}
}