Merge pull request #219 from toasted-nutbread/fix-null-caret-position
Handle null return value of document.caretPositionFromPoint
This commit is contained in:
commit
db405ffd24
@ -267,6 +267,9 @@ const caretRangeFromPoint = (() => {
|
|||||||
// Firefox
|
// Firefox
|
||||||
return (x, y) => {
|
return (x, y) => {
|
||||||
const position = document.caretPositionFromPoint(x, y);
|
const position = document.caretPositionFromPoint(x, y);
|
||||||
|
if (position === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const node = position.offsetNode;
|
const node = position.offsetNode;
|
||||||
if (node === null) {
|
if (node === null) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user