Home / Function/ genAttrSegment() — vue Function Reference

genAttrSegment() — vue Function Reference

Architecture documentation for the genAttrSegment() function in modules.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  86d4a3c9_c203_baee_605e_9fdf44bd3b10["genAttrSegment()"]
  b21c37a0_77e9_304d_e550_47589d4536f4["genAttrSegments()"]
  b21c37a0_77e9_304d_e550_47589d4536f4 -->|calls| 86d4a3c9_c203_baee_605e_9fdf44bd3b10
  96b3c31f_f988_202a_442b_1f0ff39f4f33["genDOMPropSegments()"]
  96b3c31f_f988_202a_442b_1f0ff39f4f33 -->|calls| 86d4a3c9_c203_baee_605e_9fdf44bd3b10
  style 86d4a3c9_c203_baee_605e_9fdf44bd3b10 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/optimizing-compiler/modules.ts lines 56–78

function genAttrSegment(name: string, value: string): StringSegment {
  if (plainStringRE.test(value)) {
    // force double quote
    value = value.replace(/^'|'$/g, '"')
    // force enumerated attr to "true"
    if (isEnumeratedAttr(name) && value !== `"false"`) {
      value = `"true"`
    }
    return {
      type: RAW,
      value: isBooleanAttr(name)
        ? ` ${name}="${name}"`
        : value === '""'
        ? ` ${name}`
        : ` ${name}="${JSON.parse(value)}"`
    }
  } else {
    return {
      type: EXPRESSION,
      value: `_ssrAttr(${JSON.stringify(name)},${value})`
    }
  }
}

Subdomains

Frequently Asked Questions

What does genAttrSegment() do?
genAttrSegment() is a function in the vue codebase.
What calls genAttrSegment()?
genAttrSegment() is called by 2 function(s): genAttrSegments, genDOMPropSegments.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free