make sure ranges are created over text nodes only (fixes #80)

This commit is contained in:
Alex Yatskov 2017-09-19 23:05:17 -07:00
parent e90274519a
commit 0554aa0d27

View File

@ -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);
}
}