Sort order of properties with the same index (#94)#130
Merged
Conversation
If two declarations have the same group index and the same property index, after
sorting they should stay in order of their original appearance.
Due to some strange behaviour of `Array.prototype.sort` properties get mixed
from time to time.
For example, this:
a {
width: 0;
width: auto;
}
can suddenly become this:
a {
width: auto;
width: 0;
}
In order to avoid such situations, save node index value within extended node
and take it into account while doing `sorted.sort()`.
Contributor
|
Yay, this seems to fix issues I have, can't wait it to be merged! :) |
mishanga
added a commit
that referenced
this pull request
Dec 17, 2013
Sort order of properties with the same index (#94)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #94 + PR #104
The common problem appears to be with declarations that have same properties.
For example:
Array.prototype.sortgets confused about which declaration should appear first since they have the same group index and the same property index.So I've decided to save node's index number as one of extended node's properties and then use it inside
sorted.sort()as a helper.It does the trick.