We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 887b312 commit e71d7bcCopy full SHA for e71d7bc
src/Traits/ManipulationTrait.php
@@ -184,7 +184,9 @@ public function destroy(?string $selector = null): self {
184
public function substituteWith(string|NodeList|\DOMNode|callable $input): self {
185
$this->manipulateNodesWithInput($input, function($node, $newNodes) {
186
foreach ($newNodes as $newNode) {
187
- $node->parent()->replaceChild($newNode, $node);
+ if ($node->parent()) {
188
+ $node->parent()->replaceChild($newNode, $node);
189
+ }
190
}
191
});
192
0 commit comments