| 79 | name: 'Teleport', |
| 80 | __isTeleport: true, |
| 81 | process( |
| 82 | n1: TeleportVNode | null, |
| 83 | n2: TeleportVNode, |
| 84 | container: RendererElement, |
| 85 | anchor: RendererNode | null, |
| 86 | parentComponent: ComponentInternalInstance | null, |
| 87 | parentSuspense: SuspenseBoundary | null, |
| 88 | namespace: ElementNamespace, |
| 89 | slotScopeIds: string[] | null, |
| 90 | optimized: boolean, |
| 91 | internals: RendererInternals, |
| 92 | ): void { |
| 93 | const { |
| 94 | mc: mountChildren, |
| 95 | pc: patchChildren, |
| 96 | pbc: patchBlockChildren, |
| 97 | o: { insert, querySelector, createText, createComment, parentNode }, |
| 98 | } = internals |
| 99 | |
| 100 | const disabled = isTeleportDisabled(n2.props) |
| 101 | let { dynamicChildren } = n2 |
| 102 | |
| 103 | // #3302 |
| 104 | // HMR updated, force full diff |
| 105 | if (__DEV__ && isHmrUpdating) { |
| 106 | optimized = false |
| 107 | dynamicChildren = null |
| 108 | } |
| 109 | |
| 110 | const mount = ( |
| 111 | vnode: TeleportVNode, |
| 112 | container: RendererElement, |
| 113 | anchor: RendererNode, |
| 114 | ) => { |
| 115 | // Teleport *always* has Array children. This is enforced in both the |
| 116 | // compiler and vnode children normalization. |
| 117 | if (vnode.shapeFlag & ShapeFlags.ARRAY_CHILDREN) { |
| 118 | mountChildren( |
| 119 | vnode.children as VNodeArrayChildren, |
| 120 | container, |
| 121 | anchor, |
| 122 | parentComponent, |
| 123 | parentSuspense, |
| 124 | namespace, |
| 125 | slotScopeIds, |
| 126 | optimized, |
| 127 | ) |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | const mountToTarget = (vnode: TeleportVNode = n2) => { |
| 132 | const disabled = isTeleportDisabled(vnode.props) |
| 133 | const target = (vnode.target = resolveTarget(vnode.props, querySelector)) |
| 134 | const targetAnchor = prepareAnchor(target, vnode, createText, insert) |
| 135 | if (target) { |
| 136 | // #2652 we could be teleporting from a non-SVG tree into an SVG tree |
| 137 | if (namespace !== 'svg' && isTargetSVG(target)) { |
| 138 | namespace = 'svg' |