Skip to content

Commit a575c05

Browse files
committed
fix(octane): require lone font child in isTextLeaf
Chrome Translate replaces a single Text node with one <font> wrapper, so the replacement has no next sibling. The predicate checked only that the first child was a <font> without verifying it was the only child, letting a <font> followed by extra siblings pass as a valid text leaf. Add the missing !first.nextSibling guard to the font branch, matching the existing guard on the Text-node branch.
1 parent 9593d6b commit a575c05

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎packages/octane/src/dom-bindings.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ function isTextLeaf(node: Element): boolean {
242242
const first = node.firstChild;
243243
return (
244244
first === null ||
245-
(first.nodeType === 3 ? !first.nextSibling : (first as Element).localName === 'font')
245+
(first.nodeType === 3
246+
? !first.nextSibling
247+
: (first as Element).localName === 'font' && !first.nextSibling)
246248
);
247249
}
248250

0 commit comments

Comments
 (0)