When running round-trip parser tests on a ref with a "name" attribute appearing before the "details", we find that the attribute order will be switched to alphabetical during Parsoid html2wt:
```
<ref name="n" details="abc">def</ref>
```
is round-tripped to:
```
<ref details="abc" name="n">def</ref>
```
This causes dirty diffs and needs to be fixed. The issue is probably caused by the wt2html transformation removing the "name" attribute from the subref data-mw attrs when splitting into two refs, and when the data-mw is reconstructed during html2wt the attributes end up with the default order.
To test, remove the following lines from subReferencing.txt case "Subreferencing round trips in reverse alphabetical attribute order"
```
!! options
parsoid=wt2html
```
and then run the html2wt test for this case (example uses docker-dev):
```
./modules/mediawiki/bin/mwscript tests/parser/parserTests.php --wiki=dev --file=/srv/docker-dev/mediawiki/extensions/Cite/tests/parser/subReferencing.txt --html2wt
```
Expected failure will look like this:
```
@@ -1 +1 @@
-<ref name="a" details="0">def</ref>
+<ref details="0" name="a">def</ref>
```
There are three possible approaches so far:
* Ignore the issue and hope that selective serialization prevents dirty diffs unless a ref is edited.
* Preserve the name attribute order of appearance, eg. with a new attribute `data-parsoid.nameIndex`, and use this to manually reinsert the attribute into the right place during html2wt.
* Allow the name attribute to come through and always interpret it in a special way as the main ref name, if and only if details are present.
The first option is the simplest, the other two are brittle.