Skip to content

Commit f65589e

Browse files
committed
Performance optimizations.
1 parent 2889674 commit f65589e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/HTMLServerComponentsCompiler.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ public function process($content, $options = [])
135135
}
136136
if ($isInBodyTag) {
137137
$insertTargetName = 'html-server-components-compiler-insert-target';
138-
$componentElement->parentNode->insertBefore($domDocument->createInsertTarget($insertTargetName), $componentElement);
139-
$componentElement->parentNode->removeChild($componentElement); // must be before insertHTML because a duplicate elements IDs can occur.
138+
$componentElement->parentNode->replaceChild($domDocument->createInsertTarget($insertTargetName), $componentElement);
140139
$domDocument->insertHTML($componentResultHTML, $insertTargetName);
141140
} else {
142141
$componentElement->parentNode->removeChild($componentElement);

0 commit comments

Comments
 (0)