(
node: Node,
vnode: TeleportVNode,
parentComponent: ComponentInternalInstance | null,
parentSuspense: SuspenseBoundary | null,
slotScopeIds: string[] | null,
optimized: boolean,
{
o: { nextSibling, parentNode, querySelector, insert, createText },
}: RendererInternals<Node, Element>,
hydrateChildren: (
node: Node | null,
vnode: VNode,
container: Element,
parentComponent: ComponentInternalInstance | null,
parentSuspense: SuspenseBoundary | null,
slotScopeIds: string[] | null,
optimized: boolean,
) => Node | null,
)
| 421 | } |
| 422 | |
| 423 | function hydrateTeleport( |
| 424 | node: Node, |
| 425 | vnode: TeleportVNode, |
| 426 | parentComponent: ComponentInternalInstance | null, |
| 427 | parentSuspense: SuspenseBoundary | null, |
| 428 | slotScopeIds: string[] | null, |
| 429 | optimized: boolean, |
| 430 | { |
| 431 | o: { nextSibling, parentNode, querySelector, insert, createText }, |
| 432 | }: RendererInternals<Node, Element>, |
| 433 | hydrateChildren: ( |
| 434 | node: Node | null, |
| 435 | vnode: VNode, |
| 436 | container: Element, |
| 437 | parentComponent: ComponentInternalInstance | null, |
| 438 | parentSuspense: SuspenseBoundary | null, |
| 439 | slotScopeIds: string[] | null, |
| 440 | optimized: boolean, |
| 441 | ) => Node | null, |
| 442 | ): Node | null { |
| 443 | // lookahead until we find the target anchor |
| 444 | // we cannot rely on return value of hydrateChildren() because there |
| 445 | // could be nested teleports |
| 446 | function hydrateAnchor( |
| 447 | target: TeleportTargetElement, |
| 448 | targetNode: Node | null, |
| 449 | ) { |
| 450 | let targetAnchor = targetNode |
| 451 | while (targetAnchor) { |
| 452 | if (targetAnchor && targetAnchor.nodeType === 8) { |
| 453 | if ((targetAnchor as Comment).data === 'teleport start anchor') { |
| 454 | vnode.targetStart = targetAnchor |
| 455 | } else if ((targetAnchor as Comment).data === 'teleport anchor') { |
| 456 | vnode.targetAnchor = targetAnchor |
| 457 | target._lpa = |
| 458 | vnode.targetAnchor && nextSibling(vnode.targetAnchor as Node) |
| 459 | break |
| 460 | } |
| 461 | } |
| 462 | targetAnchor = nextSibling(targetAnchor) |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | function hydrateDisabledTeleport(node: Node, vnode: VNode) { |
| 467 | vnode.anchor = hydrateChildren( |
| 468 | nextSibling(node), |
| 469 | vnode, |
| 470 | parentNode(node)!, |
| 471 | parentComponent, |
| 472 | parentSuspense, |
| 473 | slotScopeIds, |
| 474 | optimized, |
| 475 | ) |
| 476 | } |
| 477 | |
| 478 | const target = (vnode.target = resolveTarget<Element>( |
| 479 | vnode.props, |
| 480 | querySelector, |
nothing calls this directly
no test coverage detected