Skip to content

Commit 20d1cf7

Browse files
committed
fix(SSR): Consolidate dual-regex approach to single regex
fix vuejs#7859
1 parent 6b71f97 commit 20d1cf7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/platforms/web/compiler/modules/class.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function transformNode (el: ASTElement, options: CompilerOptions) {
2222
}
2323
}
2424
if (staticClass) {
25-
el.staticClass = JSON.stringify(staticClass.replace(/\n/g, ' ').replace(/ +/g, ' '))
25+
el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' '))
2626
}
2727
const classBinding = getBindingAttr(el, 'class', false /* getStatic */)
2828
if (classBinding) {

test/ssr/ssr-string.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ describe('SSR: renderToString', () => {
12281228
})
12291229

12301230
// #7859
1231-
it('should trim excess whigtespace in class attributes', done => {
1231+
it('should trim excess whitespace in class attributes', done => {
12321232
renderVmWithOptions({
12331233
template: `
12341234
<div>

0 commit comments

Comments
 (0)