Skip to content
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

Set CSS text after style element is added to DOM, to fix crash on IE < 9... #2000

Merged
merged 1 commit into from
May 11, 2014

Conversation

David-Hari
Copy link
Contributor

The fix is based on a comment on this page: http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head.

I did not write a test for this fix because i was not able to create a basic scenario to reproduce the issue. Also, it only happens on IE 8 (and 7 too i think).

@lukeapage
Copy link
Member

Makes sense.

This page is more helpfull
http://karma.nucleuscms.org/item/101

It suggests to me that if the css contains javascript it may error if we set it before appending to the document.. Is that your case?

Because outside of that, people have been using IE8/IE9 and less far more in the past and never reported this problem..

I think we can take this but I want to be sure it fixes your problem and we understand it - because the safest change is usually to do nothing.

@David-Hari
Copy link
Contributor Author

Can css/less contain javascript? I'm using a DXImageTransform gradient for IE, but nothing else fancy.

I thought it might be the size of the css text (it was about 32KB), but tried a basic example and it was successful with twice that size.

I'm trying to think what changed to cause this.
I recently upgraded Less from 1.4 to 1.7, but i could reproduce the problem even when i went back to 1.3.
The only other thing i can think of is that the number of imports increased.

@lukeapage
Copy link
Member

and this fix definitely fixes your problem (e.g. identical scenarios, with and without?)

@David-Hari
Copy link
Contributor Author

Well, with my fix in place, IE 8 no longer crashes when running my application. I did not have time to investigate further.
Tommorrow i will try to narrow down the problem to a reproducible example.

@lukeapage
Copy link
Member

okay I think we'll just take it. Don't worry about the example. Thanks for your contribution.

lukeapage added a commit that referenced this pull request May 11, 2014
Set CSS text after style element is added to DOM, to fix crash on IE < 9...
@lukeapage lukeapage merged commit 6075c81 into less:master May 11, 2014
@David-Hari
Copy link
Contributor Author

Ok, thanks

@David-Hari
Copy link
Contributor Author

I did a bit more investigation.
I found that the problem is somehow caused by having .css files imported into a .less file. Removing those imports, or renaming them to *.less, stopped the crash.

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