Skip to content

Commit 42b68c7

Browse files
fix(compiler-sfc): fix missing whitespace issue in srcsets (#3132)
fix #3069
1 parent 0fe567a commit 42b68c7

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

packages/compiler-sfc/__tests__/__snapshots__/templateTransformSrcset.spec.ts.snap

+17-17
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import _imports_0 from './logo.png'
66
77
88
const _hoisted_1 = _imports_0
9-
const _hoisted_2 = _imports_0 + '2x'
10-
const _hoisted_3 = _imports_0 + '2x'
11-
const _hoisted_4 = _imports_0 + ', ' + _imports_0 + '2x'
12-
const _hoisted_5 = _imports_0 + '2x, ' + _imports_0
13-
const _hoisted_6 = _imports_0 + '2x, ' + _imports_0 + '3x'
14-
const _hoisted_7 = _imports_0 + ', ' + _imports_0 + '2x, ' + _imports_0 + '3x'
15-
const _hoisted_8 = \\"/logo.png\\" + ', ' + _imports_0 + '2x'
9+
const _hoisted_2 = _imports_0 + ' 2x'
10+
const _hoisted_3 = _imports_0 + ' 2x'
11+
const _hoisted_4 = _imports_0 + ', ' + _imports_0 + ' 2x'
12+
const _hoisted_5 = _imports_0 + ' 2x, ' + _imports_0
13+
const _hoisted_6 = _imports_0 + ' 2x, ' + _imports_0 + ' 3x'
14+
const _hoisted_7 = _imports_0 + ', ' + _imports_0 + ' 2x, ' + _imports_0 + ' 3x'
15+
const _hoisted_8 = \\"/logo.png\\" + ', ' + _imports_0 + ' 2x'
1616
1717
export function render(_ctx, _cache) {
1818
return (_openBlock(), _createBlock(_Fragment, null, [
@@ -132,16 +132,16 @@ import _imports_1 from '/logo.png'
132132
133133
134134
const _hoisted_1 = _imports_0
135-
const _hoisted_2 = _imports_0 + '2x'
136-
const _hoisted_3 = _imports_0 + '2x'
137-
const _hoisted_4 = _imports_0 + ', ' + _imports_0 + '2x'
138-
const _hoisted_5 = _imports_0 + '2x, ' + _imports_0
139-
const _hoisted_6 = _imports_0 + '2x, ' + _imports_0 + '3x'
140-
const _hoisted_7 = _imports_0 + ', ' + _imports_0 + '2x, ' + _imports_0 + '3x'
141-
const _hoisted_8 = _imports_1 + ', ' + _imports_1 + '2x'
142-
const _hoisted_9 = \\"https://example.com/logo.png\\" + ', ' + \\"https://example.com/logo.png\\" + '2x'
143-
const _hoisted_10 = _imports_1 + ', ' + _imports_0 + '2x'
144-
const _hoisted_11 = \\"data:image/png;base64,i\\" + '1x, ' + \\"data:image/png;base64,i\\" + '2x'
135+
const _hoisted_2 = _imports_0 + ' 2x'
136+
const _hoisted_3 = _imports_0 + ' 2x'
137+
const _hoisted_4 = _imports_0 + ', ' + _imports_0 + ' 2x'
138+
const _hoisted_5 = _imports_0 + ' 2x, ' + _imports_0
139+
const _hoisted_6 = _imports_0 + ' 2x, ' + _imports_0 + ' 3x'
140+
const _hoisted_7 = _imports_0 + ', ' + _imports_0 + ' 2x, ' + _imports_0 + ' 3x'
141+
const _hoisted_8 = _imports_1 + ', ' + _imports_1 + ' 2x'
142+
const _hoisted_9 = \\"https://example.com/logo.png\\" + ', ' + \\"https://example.com/logo.png\\" + ' 2x'
143+
const _hoisted_10 = _imports_1 + ', ' + _imports_0 + ' 2x'
144+
const _hoisted_11 = \\"data:image/png;base64,i\\" + ' 1x, ' + \\"data:image/png;base64,i\\" + ' 2x'
145145
146146
export function render(_ctx, _cache) {
147147
return (_openBlock(), _createBlock(_Fragment, null, [

packages/compiler-sfc/src/templateTransformSrcset.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ export const transformSrcset: NodeTransform = (
131131
}
132132
const isNotLast = imageCandidates.length - 1 > index
133133
if (descriptor && isNotLast) {
134-
compoundExpression.children.push(` + '${descriptor}, ' + `)
134+
compoundExpression.children.push(` + ' ${descriptor}, ' + `)
135135
} else if (descriptor) {
136-
compoundExpression.children.push(` + '${descriptor}'`)
136+
compoundExpression.children.push(` + ' ${descriptor}'`)
137137
} else if (isNotLast) {
138138
compoundExpression.children.push(` + ', ' + `)
139139
}

0 commit comments

Comments
 (0)