fix(compiler-dom): properly stringify class/style bindings when hoisting static strings
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import { escapeHtml } from '@vue/shared'
|
||||
import { escapeHtml, stringifyStyle } from '@vue/shared'
|
||||
import {
|
||||
normalizeClass,
|
||||
normalizeStyle,
|
||||
propsToAttrMap,
|
||||
hyphenate,
|
||||
isString,
|
||||
isNoUnitNumericStyleProp,
|
||||
isOn,
|
||||
isSSRSafeAttrName,
|
||||
isBooleanAttr,
|
||||
@@ -93,17 +91,5 @@ export function ssrRenderStyle(raw: unknown): string {
|
||||
return escapeHtml(raw)
|
||||
}
|
||||
const styles = normalizeStyle(raw)
|
||||
let ret = ''
|
||||
for (const key in styles) {
|
||||
const value = styles[key]
|
||||
const normalizedKey = key.indexOf(`--`) === 0 ? key : hyphenate(key)
|
||||
if (
|
||||
isString(value) ||
|
||||
(typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))
|
||||
) {
|
||||
// only render valid values
|
||||
ret += `${normalizedKey}:${value};`
|
||||
}
|
||||
}
|
||||
return escapeHtml(ret)
|
||||
return escapeHtml(stringifyStyle(styles))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user