fix(dom): fix <svg> and <foreignObject> mount and updates

This commit is contained in:
Evan You
2020-01-21 11:32:17 -05:00
parent da8c31dc7f
commit 4f06eebc1c
3 changed files with 85 additions and 13 deletions

View File

@@ -370,7 +370,7 @@ export function createRenderer<
optimized: boolean
) {
const el = (vnode.el = hostCreateElement(vnode.type as string, isSVG))
const { props, shapeFlag, transition, scopeId } = vnode
const { type, props, shapeFlag, transition, scopeId } = vnode
// props
if (props != null) {
@@ -406,7 +406,7 @@ export function createRenderer<
null,
parentComponent,
parentSuspense,
isSVG,
isSVG && type !== 'foreignObject',
optimized || vnode.dynamicChildren !== null
)
}
@@ -562,6 +562,7 @@ export function createRenderer<
)
}
const areChildrenSVG = isSVG && n2.type !== 'foreignObject'
if (dynamicChildren != null) {
patchBlockChildren(
n1.dynamicChildren!,
@@ -569,11 +570,19 @@ export function createRenderer<
el,
parentComponent,
parentSuspense,
isSVG
areChildrenSVG
)
} else if (!optimized) {
// full diff
patchChildren(n1, n2, el, null, parentComponent, parentSuspense, isSVG)
patchChildren(
n1,
n2,
el,
null,
parentComponent,
parentSuspense,
areChildrenSVG
)
}
if (newProps.onVnodeUpdated != null) {