Closed forbjok closed 2 years ago
I don't think it's worth making this a build-time feature. Replacing the BTreeMap with IndexMap seems reasonable.
I don't think it's worth making this a build-time feature. Replacing the BTreeMap with IndexMap seems reasonable.
Changed the commit into directly replacing BTreeMap with IndexMap.
I think this is a sensible change that should be made. Are there any objections to merging this?
I'm fine merging this.
But would like more votes of confidence.
@SimonSapin thoughts on PR?
Ok, since 3 days passed, and no one responded. I'm going to merge this.
I noticed that when serializing a DOM back to HTML from kuchiki, attribute order changed from the original HTML document. After some investiation, I found out that this is caused by the BTreeMap used to store attributes automatically sorting keys alphabetically.
This pull request adds an optional feature "preserve_order" (inspired by the feature of the same name in serde_json, that does exactly the same thing) that swaps BTreeMap with IndexMap (also used by serde_json), which preserves the order of its keys.