File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,21 @@ const injectFunc = `
4
4
function injectStyle(css) {
5
5
if (!css || typeof document === 'undefined') return
6
6
7
- let head = document.head || document.getElementsByTagName('head')[0]
8
- let style = document.createElement('style')
7
+ const head = document.head || document.getElementsByTagName('head')[0]
8
+ const style = document.createElement('style')
9
+ style.type = 'text/css'
10
+
11
+ if(head.firstChild) {
12
+ head.insertBefore(style, head.firstChild)
13
+ } else {
14
+ head.appendChild(style)
15
+ }
9
16
10
- head.appendChild(style)
11
- style.appendChild(document.createTextNode(css))
17
+ if(style.styleSheet) {
18
+ style.styleSheet.cssText = css
19
+ } else {
20
+ style.appendChild(document.createTextNode(css))
21
+ }
12
22
}
13
23
` ;
14
24
You can’t perform that action at this time.
0 commit comments