wip(ssr): vdom serialization
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
export function patchAttr(el: Element, key: string, value: any) {
|
||||
if (value == null) {
|
||||
// TODO explain why we are no longer checking boolean/enumerated here
|
||||
|
||||
export function patchAttr(
|
||||
el: Element,
|
||||
key: string,
|
||||
value: any,
|
||||
isSVG: boolean
|
||||
) {
|
||||
if (isSVG && key.indexOf('xlink:') === 0) {
|
||||
// TODO handle xlink
|
||||
} else if (value == null) {
|
||||
el.removeAttribute(key)
|
||||
} else {
|
||||
// TODO in dev mode, warn against incorrect values for boolean or
|
||||
// enumerated attributes
|
||||
el.setAttribute(key, value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export function patchProp(
|
||||
} else if (key === 'false-value') {
|
||||
;(el as any)._falseValue = nextValue
|
||||
}
|
||||
patchAttr(el, key, nextValue)
|
||||
patchAttr(el, key, nextValue, isSVG)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user