-
-
Notifications
You must be signed in to change notification settings - Fork 40
Unstable attributes sorting #732
Copy link
Copy link
Closed
Description
The xmlSortAttributesByKey option is unstable when comparing an xmlns attribute with another prefixed attribute. For example, consider the following XML element:
<foo xmlns:foo="http://www.example.org" foo:foo="1" />Formatting it with prettier --plugin=@prettier/plugin-xml --write --xml-sort-attributes-by-key swaps attributes:
<foo foo:foo="1" xmlns:foo="http://www.example.org" />However, running the same command again, swaps the attributes once more, changing the code back to its original form.
The possible culprit of this behavior may be the following line:
Line 431 in b0a1dd7
| if (rightNS === "xlmns") return 1; |
There's a typo in the if statement—instead of xmlns, it's xlmns.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels