Skip to content

Commit 278b9ba

Browse files
committed
fixed 'unknow runtime error' ie IE8
1 parent 48eed00 commit 278b9ba

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/helpers/injectCSS.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ function injectStyle(css) {
3434
if (!style) {
3535
style = document.createElement('style');
3636
style.setAttribute('id', 'rackt-style');
37-
var head = document.getElementsByTagName('head')[0];
38-
head.insertBefore(style, head.firstChild);
37+
style.setAttribute("type", "text/css");
38+
}
39+
40+
if (style.styleSheet) {
41+
style.styleSheet.cssText = css;
42+
document.body.appendChild(style);
43+
} else {
44+
style.innerHTML = css;
45+
document.head.appendChild(style);
3946
}
40-
style.innerHTML = style.innerHTML+'\n'+css;
4147
}
4248

0 commit comments

Comments
 (0)