Handle null return value of document.caretPositionFromPoint
This commit is contained in:
parent
e3fb9603e2
commit
02927f9004
@ -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