|
|
@@ -264,15 +264,17 @@ function stringifyElement(
|
|
|
} else if (p.type === NodeTypes.DIRECTIVE && p.name === 'bind') {
|
|
|
// constant v-bind, e.g. :foo="1"
|
|
|
let evaluated = evaluateConstant(p.exp as SimpleExpressionNode)
|
|
|
- const arg = p.arg && (p.arg as SimpleExpressionNode).content
|
|
|
- if (arg === 'class') {
|
|
|
- evaluated = normalizeClass(evaluated)
|
|
|
- } else if (arg === 'style') {
|
|
|
- evaluated = stringifyStyle(normalizeStyle(evaluated))
|
|
|
+ if (evaluated != null) {
|
|
|
+ const arg = p.arg && (p.arg as SimpleExpressionNode).content
|
|
|
+ if (arg === 'class') {
|
|
|
+ evaluated = normalizeClass(evaluated)
|
|
|
+ } else if (arg === 'style') {
|
|
|
+ evaluated = stringifyStyle(normalizeStyle(evaluated))
|
|
|
+ }
|
|
|
+ res += ` ${(p.arg as SimpleExpressionNode).content}="${escapeHtml(
|
|
|
+ evaluated
|
|
|
+ )}"`
|
|
|
}
|
|
|
- res += ` ${(p.arg as SimpleExpressionNode).content}="${escapeHtml(
|
|
|
- evaluated
|
|
|
- )}"`
|
|
|
}
|
|
|
}
|
|
|
if (context.scopeId) {
|