Skip to content

Commit

Permalink
we can just reuse morphNodeTo instead of this half-working mess.
Browse files Browse the repository at this point in the history
  • Loading branch information
botandrose-machine committed Dec 23, 2024
1 parent 932a1d1 commit 31ba94a
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/idiomorph.js
Original file line number Diff line number Diff line change
Expand Up @@ -1249,22 +1249,10 @@ var Idiomorph = (function () {
if (matchElement.parentElement?.moveBefore) {
// @ts-ignore - use proposed moveBefore feature
matchElement.parentElement.moveBefore(element, matchElement);
while (matchElement.hasChildNodes()) {
// @ts-ignore - use proposed moveBefore feature
element.moveBefore(matchElement.firstChild, null);
}
} else {
matchElement.before(element);
while (matchElement.firstChild) {
element.insertBefore(matchElement.firstChild, null);
}
}
if (
ctx.callbacks.beforeNodeMorphed(element, matchElement) !== false
) {
syncNodeFrom(matchElement, element, ctx);
ctx.callbacks.afterNodeMorphed(element, matchElement);
}
morphOldNodeTo(element, matchElement, ctx);
matchElement.remove();
}
});
Expand Down

0 comments on commit 31ba94a

Please sign in to comment.