Created
June 23, 2010 16:27
-
-
Save dperini/450163 to your computer and use it in GitHub Desktop.
This file contains 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
// this is how I fixed IE6-8 crashing on | |
// dynamic insertion of at-rules inside | |
// stylesheets (for example @font-face) | |
// UPDATE: | |
// Fix by MS, move up the style insertion | |
// before the stylesheet rule manipulation | |
function setStyle(rules) { | |
var d = document, | |
r = d.documentElement, | |
s = d.createElement('style'), | |
h = d.getElementsByTagName('head')[0] || r; | |
s.type = 'text/css'; | |
h.insertBefore(s, h.firstChild); | |
s.styleSheet.cssText = rules; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment