Catch WrongDocumentError thrown by compareBoundaryPoints (#491)
* Catch WrongDocumentError thrown by compareBoundaryPoints * Filter error based on name
This commit is contained in:
parent
efa7a5ecc3
commit
51032d1eca
@ -94,7 +94,15 @@ class TextSourceRange {
|
||||
this.rangeStartOffset === other.rangeStartOffset
|
||||
);
|
||||
} else {
|
||||
try {
|
||||
return this.range.compareBoundaryPoints(Range.START_TO_START, other.range) === 0;
|
||||
} catch (e) {
|
||||
if (e.name === 'WrongDocumentError') {
|
||||
// This can happen with shadow DOMs if the ranges are in different documents.
|
||||
return false;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user