Skip to content

Commit 35682ae

Browse files
committed
fix(lint): address targeted follow-ups
1 parent 04b90de commit 35682ae

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/manipulation.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ export function replaceElement(
4949
const { parent } = replacement;
5050
if (parent) {
5151
const childs = parent.children;
52-
childs[childs.lastIndexOf(element)] = replacement;
52+
const childsIndex = childs.lastIndexOf(element);
53+
if (childsIndex === -1) {
54+
return;
55+
}
56+
57+
childs[childsIndex] = replacement;
5358
element.parent = null;
5459
}
5560
}

0 commit comments

Comments
 (0)