Fix bug when css rules are in peculiar order #79
Merged
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.
One of my programmers fixed this, not me, so apologies for any inaccuracy in my explanation.
Some versions of IE will reorganize css selectors into a specific order for the cssRules styleSheet property. The rewritten rule looks something like '[min-width~="400px"]div.myclassname'. This catches the elementqueries regex by surprise and failure occurs. Now, IE does this and it's weird, but it's perfectly valid CSS and any user could write CSS like this if they want to and you could reproduce the problem in Firefox or Chrome.
We fixed it up to hopefully cover all valid CSS cases. Once this is done, we found we could move the cssText property to the end of the list because we don't have a problem with what IE provides any more. This improves initial load performance in IE somewhat.
There is another pull request that directly conflicts with this. I didn't analyze the difference but we have been testing this thoroughly for two months in all browsers and it's solid.