(vnode: VNode, vars: Record<string, unknown>)
| 67 | } |
| 68 | |
| 69 | function setVarsOnVNode(vnode: VNode, vars: Record<string, unknown>) { |
| 70 | if (__FEATURE_SUSPENSE__ && vnode.shapeFlag & ShapeFlags.SUSPENSE) { |
| 71 | const suspense = vnode.suspense! |
| 72 | vnode = suspense.activeBranch! |
| 73 | if (suspense.pendingBranch && !suspense.isHydrating) { |
| 74 | suspense.effects.push(() => { |
| 75 | setVarsOnVNode(suspense.activeBranch!, vars) |
| 76 | }) |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | // drill down HOCs until it's a non-component vnode |
| 81 | while (vnode.component) { |
| 82 | vnode = vnode.component.subTree |
| 83 | } |
| 84 | |
| 85 | if (vnode.shapeFlag & ShapeFlags.ELEMENT && vnode.el) { |
| 86 | setVarsOnNode(vnode.el as Node, vars) |
| 87 | } else if (vnode.type === Fragment) { |
| 88 | ;(vnode.children as VNode[]).forEach(c => setVarsOnVNode(c, vars)) |
| 89 | } else if (vnode.type === Static) { |
| 90 | let { el, anchor } = vnode |
| 91 | while (el) { |
| 92 | setVarsOnNode(el as Node, vars) |
| 93 | if (el === anchor) break |
| 94 | el = el.nextSibling |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | function setVarsOnNode(el: Node, vars: Record<string, unknown>) { |
| 100 | if (el.nodeType === 1) { |
no test coverage detected