Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eda18b0

Browse filesBrowse files
authored
fix: shouldn't remove attribute quotes in HTML (#5899)
1 parent 5b70fc2 commit eda18b0
Copy full SHA for eda18b0

File tree

Expand file treeCollapse file tree

6 files changed

+63
-64
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+63
-64
lines changed

‎packages/@vue/cli-plugin-pwa/__tests__/pwaPlugin.spec.js

Copy file name to clipboardExpand all lines: packages/@vue/cli-plugin-pwa/__tests__/pwaPlugin.spec.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ test('pwa', async () => {
3030
const index = await project.read('dist/index.html')
3131

3232
// should split and preload app.js & vendor.js
33-
expect(index).toMatch(/<link [^>]+js\/app[^>]+\.js rel=preload as=script>/)
34-
expect(index).toMatch(/<link [^>]+js\/chunk-vendors[^>]+\.js rel=preload as=script>/)
33+
expect(index).toMatch(/<link [^>]+js\/app[^>]+\.js" rel="preload" as="script">/)
34+
expect(index).toMatch(/<link [^>]+js\/chunk-vendors[^>]+\.js" rel="preload" as="script">/)
3535
// should preload css
36-
expect(index).toMatch(/<link [^>]+app[^>]+\.css rel=preload as=style>/)
36+
expect(index).toMatch(/<link [^>]+app[^>]+\.css" rel="preload" as="style">/)
3737

3838
// PWA specific directives
39-
expect(index).toMatch(`<link rel=manifest href=/manifest.json>`)
39+
expect(index).toMatch(`<link rel="manifest" href="/manifest.json">`)
4040
// favicon is not minified because it's technically a comment
4141
expect(index).toMatch(`<!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]-->`)
42-
expect(index).toMatch(`<meta name=apple-mobile-web-app-capable content=no>`)
42+
expect(index).toMatch(`<meta name="apple-mobile-web-app-capable" content="no">`)
4343

4444
// should import service worker script
4545
const main = await project.read('src/main.js')

‎packages/@vue/cli-service/__tests__/build.spec.js

Copy file name to clipboardExpand all lines: packages/@vue/cli-service/__tests__/build.spec.js
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ test('build', async () => {
2828

2929
const index = await project.read('dist/index.html')
3030
// should split and preload app.js & vendor.js
31-
expect(index).toMatch(/<link [^>]+js\/app[^>]+\.js rel=preload as=script>/)
32-
expect(index).toMatch(/<link [^>]+js\/chunk-vendors[^>]+\.js rel=preload as=script>/)
31+
expect(index).toMatch(/<link [^>]+js\/app[^>]+\.js" rel="preload" as="script">/)
32+
expect(index).toMatch(/<link [^>]+js\/chunk-vendors[^>]+\.js" rel="preload" as="script">/)
3333
// should preload css
34-
expect(index).toMatch(/<link [^>]+app[^>]+\.css rel=preload as=style>/)
34+
expect(index).toMatch(/<link [^>]+app[^>]+\.css" rel="preload" as="style">/)
3535

3636
// should inject scripts
37-
expect(index).toMatch(/<script src=\/js\/chunk-vendors\.\w{8}\.js>/)
38-
expect(index).toMatch(/<script src=\/js\/app\.\w{8}\.js>/)
37+
expect(index).toMatch(/<script src="\/js\/chunk-vendors\.\w{8}\.js">/)
38+
expect(index).toMatch(/<script src="\/js\/app\.\w{8}\.js">/)
3939
// should inject css
40-
expect(index).toMatch(/<link href=\/css\/app\.\w{8}\.css rel=stylesheet>/)
40+
expect(index).toMatch(/<link href="\/css\/app\.\w{8}\.css" rel="stylesheet">/)
4141

4242
// should reference favicon with correct base URL
43-
expect(index).toMatch(/<link rel=icon href=\/favicon.ico>/)
43+
expect(index).toMatch(/<link rel="icon" href="\/favicon.ico">/)
4444

4545
const port = await portfinder.getPortPromise()
4646
server = createServer({ root: path.join(project.dir, 'dist') })

‎packages/@vue/cli-service/__tests__/cors.spec.js

Copy file name to clipboardExpand all lines: packages/@vue/cli-service/__tests__/cors.spec.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ test('build', async () => {
3030
// expect(index).toMatch(/<link [^>]+app[^>]+\.css rel=preload as=style crossorigin>/)
3131

3232
// should apply crossorigin and add integrity to scripts and css
33-
expect(index).toMatch(/<script src=\/js\/chunk-vendors\.\w{8}\.js crossorigin integrity=sha384-.{64}\s?>/)
34-
expect(index).toMatch(/<script src=\/js\/app\.\w{8}\.js crossorigin integrity=sha384-.{64}\s?>/)
35-
expect(index).toMatch(/<link href=\/css\/app\.\w{8}\.css rel=stylesheet crossorigin integrity=sha384-.{64}\s?>/)
33+
expect(index).toMatch(/<script src="\/js\/chunk-vendors\.\w{8}\.js" crossorigin integrity="sha384-.{64}\s?">/)
34+
expect(index).toMatch(/<script src="\/js\/app\.\w{8}\.js" crossorigin integrity="sha384-.{64}\s?">/)
35+
expect(index).toMatch(/<link href="\/css\/app\.\w{8}\.css" rel="stylesheet" crossorigin integrity="sha384-.{64}\s?">/)
3636

3737
// verify integrity is correct by actually running it
3838
const port = await portfinder.getPortPromise()

‎packages/@vue/cli-service/__tests__/modernMode.spec.js

Copy file name to clipboardExpand all lines: packages/@vue/cli-service/__tests__/modernMode.spec.js
+14-14Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ test('modern mode', async () => {
3131
// assert correct asset links
3232
const index = await project.read('dist/index.html')
3333

34-
// should use <script type="module" crossorigin=use-credentials> for modern bundle
35-
expect(index).toMatch(/<script type=module src=\/js\/chunk-vendors\.\w{8}\.js>/)
36-
expect(index).toMatch(/<script type=module src=\/js\/app\.\w{8}\.js>/)
34+
// should use <script type="module" crossorigin="use-credentials"> for modern bundle
35+
expect(index).toMatch(/<script type="module" src="\/js\/chunk-vendors\.\w{8}\.js">/)
36+
expect(index).toMatch(/<script type="module" src="\/js\/app\.\w{8}\.js">/)
3737

38-
// should use <link rel="modulepreload" crossorigin=use-credentials> for modern bundle
39-
expect(index).toMatch(/<link [^>]*js\/chunk-vendors\.\w{8}\.js rel=modulepreload as=script>/)
40-
expect(index).toMatch(/<link [^>]*js\/app\.\w{8}\.js rel=modulepreload as=script>/)
38+
// should use <link rel="modulepreload" crossorigin="use-credentials"> for modern bundle
39+
expect(index).toMatch(/<link [^>]*js\/chunk-vendors\.\w{8}\.js" rel="modulepreload" as="script">/)
40+
expect(index).toMatch(/<link [^>]*js\/app\.\w{8}\.js" rel="modulepreload" as="script">/)
4141

4242
// should use <script nomodule> for legacy bundle
43-
expect(index).toMatch(/<script src=\/js\/chunk-vendors-legacy\.\w{8}\.js nomodule>/)
44-
expect(index).toMatch(/<script src=\/js\/app-legacy\.\w{8}\.js nomodule>/)
43+
expect(index).toMatch(/<script src="\/js\/chunk-vendors-legacy\.\w{8}\.js" nomodule>/)
44+
expect(index).toMatch(/<script src="\/js\/app-legacy\.\w{8}\.js" nomodule>/)
4545

4646
// should inject Safari 10 nomodule fix
4747
const { safariFix } = require('../lib/webpack/ModernModePlugin')
@@ -52,12 +52,12 @@ test('modern mode', async () => {
5252
const { stdout: stdout2 } = await project.run('vue-cli-service build --modern')
5353
expect(stdout2).toMatch('Build complete.')
5454
const index2 = await project.read('dist/index.html')
55-
// should use <script type="module" crossorigin=use-credentials> for modern bundle
56-
expect(index2).toMatch(/<script type=module src=\/js\/chunk-vendors\.\w{8}\.js crossorigin=use-credentials>/)
57-
expect(index2).toMatch(/<script type=module src=\/js\/app\.\w{8}\.js crossorigin=use-credentials>/)
58-
// should use <link rel="modulepreload" crossorigin=use-credentials> for modern bundle
59-
expect(index2).toMatch(/<link [^>]*js\/chunk-vendors\.\w{8}\.js rel=modulepreload as=script crossorigin=use-credentials>/)
60-
expect(index2).toMatch(/<link [^>]*js\/app\.\w{8}\.js rel=modulepreload as=script crossorigin=use-credentials>/)
55+
// should use <script type="module" crossorigin="use-credentials"> for modern bundle
56+
expect(index2).toMatch(/<script type="module" src="\/js\/chunk-vendors\.\w{8}\.js" crossorigin="use-credentials">/)
57+
expect(index2).toMatch(/<script type="module" src="\/js\/app\.\w{8}\.js" crossorigin="use-credentials">/)
58+
// should use <link rel="modulepreload" crossorigin="use-credentials"> for modern bundle
59+
expect(index2).toMatch(/<link [^>]*js\/chunk-vendors\.\w{8}\.js" rel="modulepreload" as="script" crossorigin="use-credentials">/)
60+
expect(index2).toMatch(/<link [^>]*js\/app\.\w{8}\.js" rel="modulepreload" as="script" crossorigin="use-credentials">/)
6161

6262
// start server and ensure the page loads properly
6363
const port = await portfinder.getPortPromise()

‎packages/@vue/cli-service/__tests__/multiPage.spec.js

Copy file name to clipboardExpand all lines: packages/@vue/cli-service/__tests__/multiPage.spec.js
+34-34Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -109,62 +109,62 @@ test('build w/ multi page', async () => {
109109

110110
const assertSharedAssets = file => {
111111
// should split and preload vendor chunk
112-
expect(file).toMatch(/<link [^>]*js\/chunk-vendors[^>]*\.js rel=preload as=script>/)
113-
expect(file).toMatch(/<script [^>]*src=\/js\/chunk-vendors\.\w+\.js>/)
112+
expect(file).toMatch(/<link [^>]*js\/chunk-vendors[^>]*\.js" rel="preload" as="script">/)
113+
expect(file).toMatch(/<script [^>]*src="\/js\/chunk-vendors\.\w+\.js">/)
114114
}
115115

116116
const index = await project.read('dist/index.html')
117117
assertSharedAssets(index)
118118
// should split and preload common js and css
119-
expect(index).toMatch(/<link [^>]*js\/chunk-common[^>]*\.js rel=preload as=script>/)
120-
expect(index).toMatch(/<script [^>]*src=\/js\/chunk-common\.\w+\.js>/)
121-
expect(index).toMatch(/<link href=\/css\/chunk-common\.\w+\.css rel=stylesheet>/)
122-
expect(index).toMatch(/<link [^>]*chunk-common[^>]*\.css rel=preload as=style>/)
119+
expect(index).toMatch(/<link [^>]*js\/chunk-common[^>]*\.js" rel="preload" as="script">/)
120+
expect(index).toMatch(/<script [^>]*src="\/js\/chunk-common\.\w+\.js">/)
121+
expect(index).toMatch(/<link href="\/css\/chunk-common\.\w+\.css" rel="stylesheet">/)
122+
expect(index).toMatch(/<link [^>]*chunk-common[^>]*\.css" rel="preload" as="style">/)
123123
// should preload correct page file
124-
expect(index).toMatch(/<link [^>]*js\/index[^>]*\.js rel=preload as=script>/)
125-
expect(index).not.toMatch(/<link [^>]*js\/foo[^>]*\.js rel=preload as=script>/)
126-
expect(index).not.toMatch(/<link [^>]*js\/bar[^>]*\.js rel=preload as=script>/)
124+
expect(index).toMatch(/<link [^>]*js\/index[^>]*\.js" rel="preload" as="script">/)
125+
expect(index).not.toMatch(/<link [^>]*js\/foo[^>]*\.js" rel="preload" as="script">/)
126+
expect(index).not.toMatch(/<link [^>]*js\/bar[^>]*\.js" rel="preload" as="script">/)
127127
// should prefetch async chunk js and css
128-
expect(index).toMatch(/<link [^>]*css\/chunk-\w+\.\w+\.css rel=prefetch>/)
129-
expect(index).toMatch(/<link [^>]*js\/chunk-\w+\.\w+\.js rel=prefetch>/)
128+
expect(index).toMatch(/<link [^>]*css\/chunk-\w+\.\w+\.css" rel="prefetch">/)
129+
expect(index).toMatch(/<link [^>]*js\/chunk-\w+\.\w+\.js" rel="prefetch">/)
130130
// should load correct page js
131-
expect(index).toMatch(/<script [^>]*src=\/js\/index\.\w+\.js>/)
132-
expect(index).not.toMatch(/<script [^>]*src=\/js\/foo\.\w+\.js>/)
133-
expect(index).not.toMatch(/<script [^>]*src=\/js\/bar\.\w+\.js>/)
131+
expect(index).toMatch(/<script [^>]*src="\/js\/index\.\w+\.js">/)
132+
expect(index).not.toMatch(/<script [^>]*src="\/js\/foo\.\w+\.js">/)
133+
expect(index).not.toMatch(/<script [^>]*src="\/js\/bar\.\w+\.js">/)
134134

135135
const foo = await project.read('dist/foo.html')
136136
assertSharedAssets(foo)
137137
// should preload correct page file
138-
expect(foo).not.toMatch(/<link [^>]*js\/index[^>]*\.js rel=preload as=script>/)
139-
expect(foo).toMatch(/<link [^>]*js\/foo[^>]*\.js rel=preload as=script>/)
140-
expect(foo).not.toMatch(/<link [^>]*js\/bar[^>]*\.js rel=preload as=script>/)
138+
expect(foo).not.toMatch(/<link [^>]*js\/index[^>]*\.js" rel="preload" as="script">/)
139+
expect(foo).toMatch(/<link [^>]*js\/foo[^>]*\.js" rel="preload" as="script">/)
140+
expect(foo).not.toMatch(/<link [^>]*js\/bar[^>]*\.js" rel="preload" as="script">/)
141141
// should not prefetch async chunk js and css because it's not used by
142142
// this entry
143-
expect(foo).not.toMatch(/<link [^>]*css\/chunk-\w+\.\w+\.css rel=prefetch>/)
144-
expect(foo).not.toMatch(/<link [^>]*js\/chunk-\w+\.\w+\.js rel=prefetch>/)
143+
expect(foo).not.toMatch(/<link [^>]*css\/chunk-\w+\.\w+\.css" rel="prefetch">/)
144+
expect(foo).not.toMatch(/<link [^>]*js\/chunk-\w+\.\w+\.js" rel="prefetch">/)
145145
// should load correct page js
146-
expect(foo).not.toMatch(/<script [^>]*src=\/js\/index\.\w+\.js>/)
147-
expect(foo).toMatch(/<script [^>]*src=\/js\/foo\.\w+\.js>/)
148-
expect(foo).not.toMatch(/<script [^>]*src=\/js\/bar\.\w+\.js>/)
146+
expect(foo).not.toMatch(/<script [^>]*src="\/js\/index\.\w+\.js">/)
147+
expect(foo).toMatch(/<script [^>]*src="\/js\/foo\.\w+\.js">/)
148+
expect(foo).not.toMatch(/<script [^>]*src="\/js\/bar\.\w+\.js">/)
149149

150150
const bar = await project.read('dist/bar.html')
151151
assertSharedAssets(bar)
152152
// bar & index have a shared common chunk (App.vue)
153-
expect(bar).toMatch(/<link [^>]*js\/chunk-common[^>]*\.js rel=preload as=script>/)
154-
expect(bar).toMatch(/<script [^>]*src=\/js\/chunk-common\.\w+\.js>/)
155-
expect(bar).toMatch(/<link href=\/css\/chunk-common\.\w+\.css rel=stylesheet>/)
156-
expect(bar).toMatch(/<link [^>]*chunk-common[^>]*\.css rel=preload as=style>/)
153+
expect(bar).toMatch(/<link [^>]*js\/chunk-common[^>]*\.js" rel="preload" as="script">/)
154+
expect(bar).toMatch(/<script [^>]*src="\/js\/chunk-common\.\w+\.js">/)
155+
expect(bar).toMatch(/<link href="\/css\/chunk-common\.\w+\.css" rel="stylesheet">/)
156+
expect(bar).toMatch(/<link [^>]*chunk-common[^>]*\.css" rel="preload" as="style">/)
157157
// should preload correct page file
158-
expect(bar).not.toMatch(/<link [^>]*js\/index[^>]*\.js rel=preload as=script>/)
159-
expect(bar).not.toMatch(/<link [^>]*js\/foo[^>]*\.js rel=preload as=script>/)
160-
expect(bar).toMatch(/<link [^>]*js\/bar[^>]*\.js rel=preload as=script>/)
158+
expect(bar).not.toMatch(/<link [^>]*js\/index[^>]*\.js" rel="preload" as="script">/)
159+
expect(bar).not.toMatch(/<link [^>]*js\/foo[^>]*\.js" rel="preload" as="script">/)
160+
expect(bar).toMatch(/<link [^>]*js\/bar[^>]*\.js" rel="preload" as="script">/)
161161
// should prefetch async chunk js and css
162-
expect(bar).toMatch(/<link [^>]*css\/chunk-\w+\.\w+\.css rel=prefetch>/)
163-
expect(bar).toMatch(/<link [^>]*js\/chunk-\w+\.\w+\.js rel=prefetch>/)
162+
expect(bar).toMatch(/<link [^>]*css\/chunk-\w+\.\w+\.css" rel="prefetch">/)
163+
expect(bar).toMatch(/<link [^>]*js\/chunk-\w+\.\w+\.js" rel="prefetch">/)
164164
// should load correct page js
165-
expect(bar).not.toMatch(/<script [^>]*src=\/js\/index\.\w+\.js>/)
166-
expect(bar).not.toMatch(/<script [^>]*src=\/js\/foo\.\w+\.js>/)
167-
expect(bar).toMatch(/<script [^>]*src=\/js\/bar\.\w+\.js>/)
165+
expect(bar).not.toMatch(/<script [^>]*src="\/js\/index\.\w+\.js">/)
166+
expect(bar).not.toMatch(/<script [^>]*src="\/js\/foo\.\w+\.js">/)
167+
expect(bar).toMatch(/<script [^>]*src="\/js\/bar\.\w+\.js">/)
168168

169169
// assert pages work
170170
const port = await portfinder.getPortPromise()

‎packages/@vue/cli-service/lib/config/app.js

Copy file name to clipboardExpand all lines: packages/@vue/cli-service/lib/config/app.js
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ module.exports = (api, options) => {
121121
minify: {
122122
removeComments: true,
123123
collapseWhitespace: true,
124-
removeAttributeQuotes: true,
125124
collapseBooleanAttributes: true,
126125
removeScriptTypeAttributes: true
127126
// more options:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.