lwc
lwc copied to clipboard
Inconsistent attribute ordering between static/dynamic nodes
Description
Due to the static content optimization, the ordering of attributes in the DOM may be inconsistent.
This is only an issue if you are relying on the iteration order of elm.attributes, or the exact string output of elm.outerHTML, or something like that.
Our Jest serializer also pretty-prints HTML, so the difference is smoothed over in that case.
Related: #4124
Steps to Reproduce
Static output:
<div data-foo="foo" data-bar="bar" class="clazzy" style="color: blue">yolo</div>
Dynamic output:
<div class="clazzy" style="color: blue" data-foo="foo" data-bar="bar">yolo</div>
Expected Results
The attribute order should be identical.
Actual Results
The attribute order is different.
This issue has been linked to a new work item: W-16419700