fix(compiler): condense whitespaces in static class attributes (#4432)

fix #4251
This commit is contained in:
Roy Eden
2021-09-07 13:01:17 -03:00
committed by GitHub
parent 5d262e08d5
commit b8653d390a
2 changed files with 76 additions and 0 deletions

View File

@@ -716,6 +716,17 @@ function parseAttributes(
}
const attr = parseAttribute(context, attributeNames)
// Trim whitespace between class
// https://github.com/vuejs/vue-next/issues/4251
if (
attr.type === NodeTypes.ATTRIBUTE &&
attr.value &&
attr.name === 'class'
) {
attr.value.content = attr.value.content.replace(/\s+/g, ' ').trim()
}
if (type === TagType.Start) {
props.push(attr)
}