MCPcopy
hub / github.com/vuejs/core / setVarsOnVNode

Function setVarsOnVNode

packages/runtime-dom/src/helpers/useCssVars.ts:69–97  ·  view source on GitHub ↗
(vnode: VNode, vars: Record<string, unknown>)

Source from the content-addressed store, hash-verified

67}
68
69function 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
99function setVarsOnNode(el: Node, vars: Record<string, unknown>) {
100 if (el.nodeType === 1) {

Callers 1

setVarsFunction · 0.85

Calls 3

setVarsOnNodeFunction · 0.85
forEachMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected