"GWicke" posted a comment on MediaWiki.r111844.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/111844#c31270

Commit summary for MediaWiki.r111844:

* Always sort attributes (+1 test pass).

  The performance impact for .sort is quite small (12.079s => 12.158s)
  and Sanitizer is probably one of the more accessible places to do this.

GWicke's comment:

Sorting the attributes adds some more round-trip normalization, which again 
makes it harder to avoid dirty diffs.

I see a few options:
* Remember the order in dataAttribs
* Sort the attributes before comparing the html in parserTests, and avoid the 
reordering in the normal case
* Always sort, and thus take the hit once but simplify matters later (what you 
just added)

The DOM spec does not guaranteed the preservation of order, but in practice 
most implementations seem to keep the order intact. So I guess all three 
options are possible. I would favor simply not touching the order for now, as 
the only motivation we have for it right now is to get a parser test to pass. 
Easier to just whitelist that test IMO.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to