Skip to content

Commit

Permalink
AbstractChooseOptimization: optimized isEqualNode() for the common case
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Dec 22, 2023
1 parent 2abfa1b commit d9d5071
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function isEmpty()
/**
* Test whether two nodes are identical
*
* ext/dom does not support isEqualNode() from DOM Level 3 so this is a makeshift replacement.
* PHP < 8.3 does not support isEqualNode() from DOM Level 3 so this is a makeshift replacement.
* Unlike the DOM 3 function, attributes order matters
*
* @param DOMNode $node1
Expand All @@ -81,7 +81,7 @@ protected function isEmpty()
*/
protected function isEqualNode(DOMNode $node1, DOMNode $node2)
{
return ($node1->ownerDocument->saveXML($node1) === $node2->ownerDocument->saveXML($node2));
return ($node1->nodeName === $node2->nodeName && $node1->ownerDocument->saveXML($node1) === $node2->ownerDocument->saveXML($node2));
}

/**
Expand Down

0 comments on commit d9d5071

Please sign in to comment.