Home / Function/ markStatic() — vue Function Reference

markStatic() — vue Function Reference

Architecture documentation for the markStatic() function in optimizer.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  aa905c19_18e1_1ec3_26d9_4dceaf61468a["markStatic()"]
  4dd348f6_49d4_7d90_cd43_a028cf7729f6["optimize()"]
  4dd348f6_49d4_7d90_cd43_a028cf7729f6 -->|calls| aa905c19_18e1_1ec3_26d9_4dceaf61468a
  78a02cff_e7b9_c4ef_d6d7_44de6eda5377["isStatic()"]
  aa905c19_18e1_1ec3_26d9_4dceaf61468a -->|calls| 78a02cff_e7b9_c4ef_d6d7_44de6eda5377
  style aa905c19_18e1_1ec3_26d9_4dceaf61468a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/compiler/optimizer.ts lines 40–70

function markStatic(node: ASTNode) {
  node.static = isStatic(node)
  if (node.type === 1) {
    // do not make component slot content static. this avoids
    // 1. components not able to mutate slot nodes
    // 2. static slot content fails for hot-reloading
    if (
      !isPlatformReservedTag(node.tag) &&
      node.tag !== 'slot' &&
      node.attrsMap['inline-template'] == null
    ) {
      return
    }
    for (let i = 0, l = node.children.length; i < l; i++) {
      const child = node.children[i]
      markStatic(child)
      if (!child.static) {
        node.static = false
      }
    }
    if (node.ifConditions) {
      for (let i = 1, l = node.ifConditions.length; i < l; i++) {
        const block = node.ifConditions[i].block
        markStatic(block)
        if (!block.static) {
          node.static = false
        }
      }
    }
  }
}

Subdomains

Calls

Called By

Frequently Asked Questions

What does markStatic() do?
markStatic() is a function in the vue codebase.
What does markStatic() call?
markStatic() calls 1 function(s): isStatic.
What calls markStatic()?
markStatic() 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