anchor,
parentComponent,
parentSuspense,
- isSVG
+ isSVG,
+ optimized
)
} else {
patchElement(n1, n2, parentComponent, parentSuspense, isSVG, optimized)
anchor: HostNode | null,
parentComponent: ComponentInternalInstance | null,
parentSuspense: HostSuspenseBoundary | null,
- isSVG: boolean
+ isSVG: boolean,
+ optimized: boolean
) {
const tag = vnode.type as string
isSVG = isSVG || tag === 'svg'
null,
parentComponent,
parentSuspense,
- isSVG
+ isSVG,
+ optimized || vnode.dynamicChildren !== null
)
}
hostInsert(el, container, anchor)
parentComponent: ComponentInternalInstance | null,
parentSuspense: HostSuspenseBoundary | null,
isSVG: boolean,
+ optimized: boolean,
start: number = 0
) {
for (let i = start; i < children.length; i++) {
- const child = (children[i] = normalizeVNode(children[i]))
+ const child = optimized
+ ? (children[i] as HostVNode)
+ : (children[i] = normalizeVNode(children[i]))
patch(
null,
child,
anchor,
parentComponent,
parentSuspense,
- isSVG
+ isSVG,
+ optimized
)
}
}
fragmentEndAnchor,
parentComponent,
parentSuspense,
- isSVG
+ isSVG,
+ optimized
)
} else {
patchChildren(
null,
parentComponent,
parentSuspense,
- isSVG
+ isSVG,
+ optimized
)
}
} else if (__DEV__) {
anchor,
parentComponent,
parentSuspense,
- isSVG
+ isSVG,
+ optimized
)
}
}
const commonLength = Math.min(oldLength, newLength)
let i
for (i = 0; i < commonLength; i++) {
- const nextChild = (c2[i] = normalizeVNode(c2[i]))
+ const nextChild = optimized
+ ? (c2[i] as HostVNode)
+ : (c2[i] = normalizeVNode(c2[i]))
patch(
c1[i],
nextChild,
parentComponent,
parentSuspense,
isSVG,
+ optimized,
commonLength
)
}
// (a b) d e
while (i <= e1 && i <= e2) {
const n1 = c1[i]
- const n2 = (c2[i] = normalizeVNode(c2[i]))
+ const n2 = optimized
+ ? (c2[i] as HostVNode)
+ : (c2[i] = normalizeVNode(c2[i]))
if (isSameType(n1, n2)) {
patch(
n1,
// d e (b c)
while (i <= e1 && i <= e2) {
const n1 = c1[e1]
- const n2 = (c2[e2] = normalizeVNode(c2[e2]))
+ const n2 = optimized
+ ? (c2[i] as HostVNode)
+ : (c2[e2] = normalizeVNode(c2[e2]))
if (isSameType(n1, n2)) {
patch(
n1,
while (i <= e2) {
patch(
null,
- (c2[i] = normalizeVNode(c2[i])),
+ optimized ? (c2[i] as HostVNode) : (c2[i] = normalizeVNode(c2[i])),
container,
anchor,
parentComponent,
// 5.1 build key:index map for newChildren
const keyToNewIndexMap: Map<string | number, number> = new Map()
for (i = s2; i <= e2; i++) {
- const nextChild = (c2[i] = normalizeVNode(c2[i]))
+ const nextChild = optimized
+ ? (c2[i] as HostVNode)
+ : (c2[i] = normalizeVNode(c2[i]))
if (nextChild.key != null) {
if (__DEV__ && keyToNewIndexMap.has(nextChild.key)) {
warn(