Skip to content

Fix bug when css rules are in peculiar order #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2015

Conversation

wickning1
Copy link
Contributor

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.

marcj added a commit that referenced this pull request Dec 16, 2015
Fix bug when css rules are in peculiar order
@marcj marcj merged commit 0f80dc0 into marcj:master Dec 16, 2015
@marcj
Copy link
Owner

marcj commented Dec 16, 2015

Very nice, thanks @wickning1!

@wickning1 wickning1 deleted the selectororderfix branch December 16, 2015 22:34
@marcj marcj mentioned this pull request Dec 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants