Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 17, 2024
1 parent 707e04f commit 6c95b0b
Showing 1 changed file with 6 additions and 28 deletions.
34 changes: 6 additions & 28 deletions packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -819,16 +819,12 @@ function baseCreateRenderer(
optimized = false
dynamicChildren = null
}
// due to potential innerHTML/textContent overriding existing VNodes,
// in which case the old tree must be properly unmounted.

if (
oldProps.innerHTML !== undefined ||
oldProps.textContent !== undefined
(oldProps.innerHTML && newProps.innerHTML == null) ||
(oldProps.textContent && newProps.textContent == null)
) {
hostSetElementText(n1.el!, '')
if (n1.children) {
unmountChildren(n1.children as VNode[], parentComponent, parentSuspense)
}
hostSetElementText(el, '')
}

if (dynamicChildren) {
Expand Down Expand Up @@ -867,15 +863,7 @@ function baseCreateRenderer(
// (i.e. at the exact same position in the source template)
if (patchFlag & PatchFlags.FULL_PROPS) {
// element props contain dynamic keys, full diff needed
patchProps(
el,
n2,
oldProps,
newProps,
parentComponent,
parentSuspense,
namespace,
)
patchProps(el, oldProps, newProps, parentComponent, namespace)
} else {
// class
// this flag is matched when the element has dynamic class bindings.
Expand Down Expand Up @@ -921,15 +909,7 @@ function baseCreateRenderer(
}
} else if (!optimized && dynamicChildren == null) {
// unoptimized, full diff
patchProps(
el,
n2,
oldProps,
newProps,
parentComponent,
parentSuspense,
namespace,
)
patchProps(el, oldProps, newProps, parentComponent, namespace)
}

if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
Expand Down Expand Up @@ -986,11 +966,9 @@ function baseCreateRenderer(

const patchProps = (
el: RendererElement,
vnode: VNode,
oldProps: Data,
newProps: Data,
parentComponent: ComponentInternalInstance | null,
parentSuspense: SuspenseBoundary | null,
namespace: ElementNamespace,
) => {
if (oldProps !== newProps) {
Expand Down

0 comments on commit 6c95b0b

Please sign in to comment.