File tree 11 files changed +9
-24
lines changed
insert-undefined/expected
11 files changed +9
-24
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ module.exports = class CssLoadingRuntimeModule extends RuntimeModule {
57
57
'var linkTag = document.createElement("link");' ,
58
58
this . runtimeOptions . attributes ,
59
59
'linkTag.rel = "stylesheet";' ,
60
- 'linkTag.type = "text/css";' ,
61
60
'linkTag.onload = resolve;' ,
62
61
'linkTag.onerror = function(event) {' ,
63
62
Template . indent ( [
Original file line number Diff line number Diff line change @@ -44,10 +44,7 @@ class MiniCssExtractPlugin {
44
44
`var target = document.querySelector("${ options . insert } ");` ,
45
45
`target.parentNode.insertBefore(linkTag, target.nextSibling);` ,
46
46
] )
47
- : Template . asString ( [
48
- 'var head = document.getElementsByTagName("head")[0];' ,
49
- 'head.appendChild(linkTag);' ,
50
- ] ) ;
47
+ : Template . asString ( [ 'document.head.appendChild(linkTag);' ] ) ;
51
48
52
49
const attributes =
53
50
typeof options . attributes === 'object' ? options . attributes : { } ;
@@ -398,7 +395,6 @@ class MiniCssExtractPlugin {
398
395
'var linkTag = document.createElement("link");' ,
399
396
this . runtimeOptions . attributes ,
400
397
'linkTag.rel = "stylesheet";' ,
401
- 'linkTag.type = "text/css";' ,
402
398
'linkTag.onload = resolve;' ,
403
399
'linkTag.onerror = function(event) {' ,
404
400
Template . indent ( [
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ exports[`attributes option should work with attributes option: DOM 1`] = `
4
4
"<!DOCTYPE html><html ><head >
5
5
<title >style-loader test</title >
6
6
<style id =\\"existing-style\\">.existing { color : yellow } </style>
7
- <link id =\\"target\\" data-target =\\"example\\" rel =\\"stylesheet\\" type =\\"text/css\\" href =\\"simple.css\\"><script charset =\\"utf-8\\" src =\\"simple.bundle.js\\"></script></head>
7
+ <link id =\\"target\\" data-target =\\"example\\" rel =\\"stylesheet\\" href =\\"simple.css\\"><script charset =\\"utf-8\\" src =\\"simple.bundle.js\\"></script></head>
8
8
<body>
9
9
<h1>Body</h1>
10
10
<div class =\\"target\\"></div>
@@ -22,7 +22,7 @@ exports[`attributes option should work without attributes option: DOM 1`] = `
22
22
" <!DOCTYPE html><html><head>
23
23
<title>style-loader test</title>
24
24
<style id=\\" existing-style\\">.existing { color : yellow } </style>
25
- <link rel =\\"stylesheet\\" type =\\"text/css\\" href =\\"simple.css\\"><script charset =\\"utf-8\\" src =\\"simple.bundle.js\\"></script></head>
25
+ <link rel =\\"stylesheet\\" href =\\"simple.css\\"><script charset =\\"utf-8\\" src =\\"simple.bundle.js\\"></script></head>
26
26
<body>
27
27
<h1>Body</h1>
28
28
<div class =\\"target\\"></div>
Original file line number Diff line number Diff line change 3
3
exports [` insert option should work when insert option is function: DOM 1` ] = `
4
4
"<!DOCTYPE html><html ><head >
5
5
<title >style-loader test</title >
6
- <link rel =\\"stylesheet\\" type =\\"text/css\\" href =\\"simple.css\\"><style id =\\"existing-style\\">.existing { color : yellow } </style>
6
+ <link rel =\\"stylesheet\\" href =\\"simple.css\\"><style id =\\"existing-style\\">.existing { color : yellow } </style>
7
7
<script charset =\\"utf-8\\" src =\\"simple.bundle.js\\"></script></head>
8
8
<body>
9
9
<h1>Body</h1>
@@ -21,7 +21,7 @@ exports[`insert option should work when insert option is function: warnings 1`]
21
21
exports[`insert option should work when insert option is string: DOM 1`] = `
22
22
" <!DOCTYPE html><html><head>
23
23
<title>style-loader test</title>
24
- <style id=\\" existing-style\\">.existing { color : yellow } </style><link rel =\\"stylesheet\\" type =\\"text/css\\" href =\\"simple.css\\">
24
+ <style id=\\" existing-style\\">.existing { color : yellow } </style><link rel =\\"stylesheet\\" href =\\"simple.css\\">
25
25
<script charset =\\"utf-8\\" src =\\"simple.bundle.js\\"></script></head>
26
26
<body>
27
27
<h1>Body</h1>
@@ -40,7 +40,7 @@ exports[`insert option should work without insert option: DOM 1`] = `
40
40
" <!DOCTYPE html><html><head>
41
41
<title>style-loader test</title>
42
42
<style id=\\" existing-style\\">.existing { color : yellow } </style>
43
- <link rel =\\"stylesheet\\" type =\\"text/css\\" href =\\"simple.css\\"><script charset =\\"utf-8\\" src =\\"simple.bundle.js\\"></script></head>
43
+ <link rel =\\"stylesheet\\" href =\\"simple.css\\"><script charset =\\"utf-8\\" src =\\"simple.bundle.js\\"></script></head>
44
44
<body>
45
45
<h1>Body</h1>
46
46
<div class =\\"target\\"></div>
Original file line number Diff line number Diff line change @@ -826,7 +826,6 @@ module.exports = function (urlString) {
826
826
/******/ var linkTag = document . createElement ( "link" ) ;
827
827
/******/
828
828
/******/ linkTag . rel = "stylesheet" ;
829
- /******/ linkTag . type = "text/css" ;
830
829
/******/ linkTag . onload = resolve ;
831
830
/******/ linkTag . onerror = function ( event ) {
832
831
/******/ var request = event && event . target && event . target . href || fullhref ;
@@ -838,8 +837,7 @@ module.exports = function (urlString) {
838
837
/******/ } ;
839
838
/******/ linkTag . href = fullhref ;
840
839
/******/
841
- /******/ var head = document . getElementsByTagName ( "head" ) [ 0 ] ;
842
- /******/ head . appendChild ( linkTag ) ;
840
+ /******/ document . head . appendChild ( linkTag ) ;
843
841
/******/ return linkTag ;
844
842
/******/ } ;
845
843
/******/ var findStylesheet = ( href , fullhref ) => {
Original file line number Diff line number Diff line change 103
103
/******/ var linkTag = document . createElement ( "link" ) ;
104
104
/******/
105
105
/******/ linkTag . rel = "stylesheet" ;
106
- /******/ linkTag . type = "text/css" ;
107
106
/******/ linkTag . onload = resolve ;
108
107
/******/ linkTag . onerror = function ( event ) {
109
108
/******/ var request = event && event . target && event . target . href || fullhref ;
Original file line number Diff line number Diff line change 161
161
/******/ var linkTag = document . createElement ( "link" ) ;
162
162
/******/
163
163
/******/ linkTag . rel = "stylesheet" ;
164
- /******/ linkTag . type = "text/css" ;
165
164
/******/ linkTag . onload = resolve ;
166
165
/******/ linkTag . onerror = function ( event ) {
167
166
/******/ var request = event && event . target && event . target . href || fullhref ;
Original file line number Diff line number Diff line change 103
103
/******/ var linkTag = document . createElement ( "link" ) ;
104
104
/******/
105
105
/******/ linkTag . rel = "stylesheet" ;
106
- /******/ linkTag . type = "text/css" ;
107
106
/******/ linkTag . onload = resolve ;
108
107
/******/ linkTag . onerror = function ( event ) {
109
108
/******/ var request = event && event . target && event . target . href || fullhref ;
Original file line number Diff line number Diff line change 161
161
/******/ var linkTag = document . createElement ( "link" ) ;
162
162
/******/
163
163
/******/ linkTag . rel = "stylesheet" ;
164
- /******/ linkTag . type = "text/css" ;
165
164
/******/ linkTag . onload = resolve ;
166
165
/******/ linkTag . onerror = function ( event ) {
167
166
/******/ var request = event && event . target && event . target . href || fullhref ;
Original file line number Diff line number Diff line change 103
103
/******/ var linkTag = document . createElement ( "link" ) ;
104
104
/******/
105
105
/******/ linkTag . rel = "stylesheet" ;
106
- /******/ linkTag . type = "text/css" ;
107
106
/******/ linkTag . onload = resolve ;
108
107
/******/ linkTag . onerror = function ( event ) {
109
108
/******/ var request = event && event . target && event . target . href || fullhref ;
116
115
/******/ } ;
117
116
/******/ linkTag . href = fullhref ;
118
117
/******/
119
- /******/ var head = document . getElementsByTagName ( "head" ) [ 0 ] ;
120
- /******/ head . appendChild ( linkTag ) ;
118
+ /******/ document . head . appendChild ( linkTag ) ;
121
119
/******/ } ) . then ( function ( ) {
122
120
/******/ installedCssChunks [ chunkId ] = 0 ;
123
121
/******/ } ) ) ;
Original file line number Diff line number Diff line change 161
161
/******/ var linkTag = document . createElement ( "link" ) ;
162
162
/******/
163
163
/******/ linkTag . rel = "stylesheet" ;
164
- /******/ linkTag . type = "text/css" ;
165
164
/******/ linkTag . onload = resolve ;
166
165
/******/ linkTag . onerror = function ( event ) {
167
166
/******/ var request = event && event . target && event . target . href || fullhref ;
173
172
/******/ } ;
174
173
/******/ linkTag . href = fullhref ;
175
174
/******/
176
- /******/ var head = document . getElementsByTagName ( "head" ) [ 0 ] ;
177
- /******/ head . appendChild ( linkTag ) ;
175
+ /******/ document . head . appendChild ( linkTag ) ;
178
176
/******/ return linkTag ;
179
177
/******/ } ;
180
178
/******/ var findStylesheet = ( href , fullhref ) => {
You can’t perform that action at this time.
0 commit comments