Skip to content

Commit e32607e

Browse files
committed
Don't use a new document when importing nodes
1 parent 7c1f614 commit e32607e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/AbstractElement.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ public static function getChildrenOfClass(DOMElement $parent): array
153153
&& $node->namespaceURI === static::getNamespaceURI()
154154
&& $node->localName === static::getLocalName()
155155
) {
156-
// Normalize the DOMElement by importing it into a clean empty document
157-
$newDoc = DOMDocumentFactory::create();
158156
/** @var \DOMElement $node */
159-
$node = $newDoc->appendChild($newDoc->importNode($node, true));
157+
$node = $parent->ownerDocument->appendChild(
158+
$parent->ownerDocument->importNode($node, true),
159+
);
160160

161161
$ret[] = static::fromXML($node);
162162
}

0 commit comments

Comments
 (0)