[php-src] Issue #13012: DOMNode::isEqualNode() is incorrect when attribute order is different
| From: | JoshyPHP | Date: | Sat, 23 Dec 2023 17:58:22 +0000 |
| Subject: | [php-src] Issue #13012: DOMNode::isEqualNode() is incorrect when attribute order is different | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246113@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13012
Author: JoshyPHP
### Description
[The spec says](https://dom.spec.whatwg.org/#concept-node-equals): *"If A is an element, each
attribute in its attribute list has an attribute that equals an attribute in B’s attribute
list."* The order in which the attributes are listed should not matter.
I double checked the expected behaviour in Gecko/Blink just in case.
```php
<?php
$dom = new DOMDocument;
// <x a="a" b="b"/>
$el1 = $dom->createElement('x');
$el1->setAttribute('a', 'a');
$el1->setAttribute('b', 'b');
// <x b="b" a="a"/>
$el2 = $dom->createElement('x');
$el2->setAttribute('b', 'b');
$el2->setAttribute('a', 'a');
var_dump($el1->isEqualNode($el2));
```
Resulted in this output:
```
bool(false)
```
But I expected this output instead:
```
bool(true)
```
### PHP Version
PHP 8.3.1
### Operating System
_No response_