|
@@ -234,12 +234,12 @@ function adoptTemplateImpl(node: Node, template: string): Node | null {
|
|
|
return node
|
|
return node
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export function locateNextNode(node: Node): Node | null {
|
|
|
|
|
|
|
+export function nextLogicalSibling(node: Node): Node | null {
|
|
|
return isComment(node, '[')
|
|
return isComment(node, '[')
|
|
|
- ? _next(locateEndAnchor(node)!)
|
|
|
|
|
|
|
+ ? locateEndAnchor(node)!.nextSibling
|
|
|
: isComment(node, 'teleport start')
|
|
: isComment(node, 'teleport start')
|
|
|
- ? _next(locateEndAnchor(node, 'teleport start', 'teleport end')!)
|
|
|
|
|
- : _next(node)
|
|
|
|
|
|
|
+ ? locateEndAnchor(node, 'teleport start', 'teleport end')!.nextSibling
|
|
|
|
|
+ : node.nextSibling
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function locateHydrationNodeImpl(consumeFragmentStart = false) {
|
|
function locateHydrationNodeImpl(consumeFragmentStart = false) {
|
|
@@ -307,9 +307,9 @@ export function locateHydrationBoundaryClose(
|
|
|
if (isComment(node, ']')) {
|
|
if (isComment(node, ']')) {
|
|
|
close = node
|
|
close = node
|
|
|
} else {
|
|
} else {
|
|
|
- let candidate = locateNextNode(node)
|
|
|
|
|
|
|
+ let candidate = nextLogicalSibling(node)
|
|
|
while (candidate && !isComment(candidate, ']')) {
|
|
while (candidate && !isComment(candidate, ']')) {
|
|
|
- candidate = locateNextNode(candidate)
|
|
|
|
|
|
|
+ candidate = nextLogicalSibling(candidate)
|
|
|
}
|
|
}
|
|
|
close = candidate
|
|
close = candidate
|
|
|
}
|
|
}
|
|
@@ -472,7 +472,7 @@ export function cleanupHydrationTail(node: Node, container?: ParentNode): void {
|
|
|
|
|
|
|
|
let current: Node | null = node
|
|
let current: Node | null = node
|
|
|
while (current && current.parentNode === container) {
|
|
while (current && current.parentNode === container) {
|
|
|
- const next = locateNextNode(current)
|
|
|
|
|
|
|
+ const next = nextLogicalSibling(current)
|
|
|
removeHydrationNode(current)
|
|
removeHydrationNode(current)
|
|
|
current = next
|
|
current = next
|
|
|
}
|
|
}
|
|
@@ -529,7 +529,7 @@ function finalizeHydrationBoundary(close: Node | null): void {
|
|
|
if (!isHydrationAnchor(cur)) {
|
|
if (!isHydrationAnchor(cur)) {
|
|
|
hasRemovableNode = true
|
|
hasRemovableNode = true
|
|
|
}
|
|
}
|
|
|
- cur = locateNextNode(cur)
|
|
|
|
|
|
|
+ cur = nextLogicalSibling(cur)
|
|
|
}
|
|
}
|
|
|
if (!cur) return
|
|
if (!cur) return
|
|
|
if (!hasRemovableNode) {
|
|
if (!hasRemovableNode) {
|
|
@@ -540,7 +540,7 @@ function finalizeHydrationBoundary(close: Node | null): void {
|
|
|
warnHydrationChildrenMismatch((close as Node).parentElement)
|
|
warnHydrationChildrenMismatch((close as Node).parentElement)
|
|
|
|
|
|
|
|
while (node && node !== close) {
|
|
while (node && node !== close) {
|
|
|
- const next = locateNextNode(node)
|
|
|
|
|
|
|
+ const next = nextLogicalSibling(node)
|
|
|
if (!isHydrationAnchor(node)) {
|
|
if (!isHydrationAnchor(node)) {
|
|
|
removeHydrationNode(node, close)
|
|
removeHydrationNode(node, close)
|
|
|
}
|
|
}
|