markStaticRoots() — vue Function Reference
Architecture documentation for the markStaticRoots() function in optimizer.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD ab0b5436_992a_413b_f4ac_c55481aa026c["markStaticRoots()"] 62546a34_f736_9139_cfec_7d596f17642d["optimizer.ts"] ab0b5436_992a_413b_f4ac_c55481aa026c -->|defined in| 62546a34_f736_9139_cfec_7d596f17642d 8f748a9a_ff71_2969_6535_4a7b190ab72e["optimize()"] 8f748a9a_ff71_2969_6535_4a7b190ab72e -->|calls| ab0b5436_992a_413b_f4ac_c55481aa026c style ab0b5436_992a_413b_f4ac_c55481aa026c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/compiler/optimizer.ts lines 72–101
function markStaticRoots(node: ASTNode, isInFor: boolean) {
if (node.type === 1) {
if (node.static || node.once) {
node.staticInFor = isInFor
}
// For a node to qualify as a static root, it should have children that
// are not just static text. Otherwise the cost of hoisting out will
// outweigh the benefits and it's better off to just always render it fresh.
if (
node.static &&
node.children.length &&
!(node.children.length === 1 && node.children[0].type === 3)
) {
node.staticRoot = true
return
} else {
node.staticRoot = false
}
if (node.children) {
for (let i = 0, l = node.children.length; i < l; i++) {
markStaticRoots(node.children[i], isInFor || !!node.for)
}
}
if (node.ifConditions) {
for (let i = 1, l = node.ifConditions.length; i < l; i++) {
markStaticRoots(node.ifConditions[i].block, isInFor)
}
}
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does markStaticRoots() do?
markStaticRoots() is a function in the vue codebase, defined in src/compiler/optimizer.ts.
Where is markStaticRoots() defined?
markStaticRoots() is defined in src/compiler/optimizer.ts at line 72.
What calls markStaticRoots()?
markStaticRoots() is called by 1 function(s): optimize.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free