Skip to content

Commit 15e3d7f

Browse files
Fix error when calculating SVG highlight rectangles
1 parent 71b9fe2 commit 15e3d7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

highlight-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ function Highlighter(options = hhDefaultOptions) {
11121112
const ancestorElementsInRange = [];
11131113
for (const paragraph of paragraphs) {
11141114
let element = paragraph;
1115-
while (element !== range.commonAncestorContainer) {
1115+
while (range.commonAncestorContainer.contains(element)) {
11161116
if (!ancestorElementsInRange.includes(element)) ancestorElementsInRange.push(element);
11171117
element = element.parentElement;
11181118
}

0 commit comments

Comments
 (0)