Match-id-312daf8aa3b9932a2847f98e404ff35e5ea88b01
This commit is contained in:
parent
d1df21f264
commit
9a3c6440a1
|
@ -18,7 +18,7 @@ import {
|
|||
setProcessingClassVNode,
|
||||
setStartVNode
|
||||
} from './GlobalVar';
|
||||
import { findDomParent, getSiblingVNode } from './vnode/VNodeUtils';
|
||||
import { findDomParent } from './vnode/VNodeUtils';
|
||||
import {
|
||||
ByAsync,
|
||||
BySync,
|
||||
|
@ -108,7 +108,7 @@ function bubbleVNode(vNode: VNode): void {
|
|||
break;
|
||||
}
|
||||
|
||||
const siblingVNode = getSiblingVNode(node);
|
||||
const siblingVNode = node.next;
|
||||
if (siblingVNode !== null) { // 有兄弟vNode
|
||||
processing = siblingVNode;
|
||||
return;
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
isIteratorType,
|
||||
isObjectType,
|
||||
} from './DiffTools';
|
||||
import {getSiblingVNode, travelChildren} from '../vnode/VNodeUtils';
|
||||
import { travelChildren } from '../vnode/VNodeUtils';
|
||||
|
||||
enum DiffCategory {
|
||||
TEXT_NODE = 'TEXT_NODE',
|
||||
|
@ -249,7 +249,7 @@ function diffArrayNodes(
|
|||
nextOldNode = oldNode;
|
||||
oldNode = null;
|
||||
} else {
|
||||
nextOldNode = getSiblingVNode(oldNode);
|
||||
nextOldNode = oldNode.next;
|
||||
}
|
||||
|
||||
const canBeReuse = checkCanReuseNode(oldNode, newChildren[leftIdx]);
|
||||
|
@ -552,13 +552,13 @@ function diffObjectNodeHandler(
|
|||
// 可以复用
|
||||
if (canReuseNode.tag === Fragment && newChild.type === TYPE_FRAGMENT) {
|
||||
resultNode = updateVNode(canReuseNode, newChild.props.children);
|
||||
startDelVNode = getSiblingVNode(canReuseNode);
|
||||
startDelVNode = canReuseNode.next;
|
||||
resultNode.next = null;
|
||||
} else if (isSameType(canReuseNode, newChild)) {
|
||||
resultNode = updateVNode(canReuseNode, newChild.props);
|
||||
resultNode.ref = newChild.ref;
|
||||
resultNode.belongClassVNode = newChild.belongClassVNode;
|
||||
startDelVNode = getSiblingVNode(resultNode);
|
||||
startDelVNode = resultNode.next;
|
||||
resultNode.next = null;
|
||||
}
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ function diffObjectNodeHandler(
|
|||
// 可以复用
|
||||
if (canReuseNode.tag === DomPortal && canReuseNode.outerDom === newChild.outerDom) {
|
||||
resultNode = updateVNode(canReuseNode, newChild.children || []);
|
||||
startDelVNode = getSiblingVNode(canReuseNode);
|
||||
startDelVNode = canReuseNode.next;
|
||||
resultNode.next = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,6 @@ import {DomComponent, DomPortal, DomText, TreeRoot} from './VNodeTags';
|
|||
import {isComment} from '../../dom/utils/Common';
|
||||
import {getNearestVNode} from '../../dom/DOMInternalKeys';
|
||||
|
||||
export function getSiblingVNode(node) {
|
||||
return node.next;
|
||||
}
|
||||
|
||||
export function travelChildren(beginVNode: VNode, handleVNode: Function, isFinish?: Function) {
|
||||
let node: VNode | null = beginVNode;
|
||||
|
||||
|
@ -58,7 +54,7 @@ export function travelVNodeTree(
|
|||
}
|
||||
|
||||
// 找兄弟,没有就往上再找兄弟
|
||||
while (getSiblingVNode(node) === null) {
|
||||
while (node.next === null) {
|
||||
if (node.parent === null || node.parent === overVNode) {
|
||||
return null;
|
||||
}
|
||||
|
@ -69,7 +65,7 @@ export function travelVNodeTree(
|
|||
}
|
||||
}
|
||||
// 找到兄弟
|
||||
const siblingVNode = getSiblingVNode(node);
|
||||
const siblingVNode = node.next;
|
||||
siblingVNode.parent = node.parent;
|
||||
node = siblingVNode;
|
||||
}
|
||||
|
@ -175,7 +171,7 @@ export function getSiblingDom(vNode: VNode): Element | null {
|
|||
|
||||
findSibling: while (true) {
|
||||
// 没有兄弟节点,找父节点
|
||||
while (getSiblingVNode(node) === null) {
|
||||
while (node.next === null) {
|
||||
// 没父节点,或父节点已经是根节点,则返回
|
||||
if (node.parent === null || isDomContainer(node.parent)) {
|
||||
return null;
|
||||
|
@ -183,7 +179,7 @@ export function getSiblingDom(vNode: VNode): Element | null {
|
|||
node = node.parent;
|
||||
}
|
||||
|
||||
const siblingVNode = getSiblingVNode(node);
|
||||
const siblingVNode = node.next;
|
||||
siblingVNode.parent = node.parent;
|
||||
node = siblingVNode;
|
||||
|
||||
|
|
Loading…
Reference in New Issue