Skip to content

Commit

Permalink
Normalize elements by dropping their parent objects
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jul 24, 2024
1 parent a28b44b commit 7fb71be
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ public static function getChildrenOfClass(DOMElement $parent): array
&& $node->namespaceURI === static::getNamespaceURI()
&& $node->localName === static::getLocalName()
) {
// Normalize the DOMElement by importing it into a clean empty document
$newDoc = DOMDocumentFactory::create();
$node = $newDoc->appendChild($newDoc->importNode($node, true));

$ret[] = static::fromXML($node);
}
}
Expand Down

0 comments on commit 7fb71be

Please sign in to comment.