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
  8ee2370a_436c_cb50_dd8a_e999affa373b["genAttrSegment()"]
  92853cf6_4176_f03f_0670_cca3d63c003e["modules.ts"]
  8ee2370a_436c_cb50_dd8a_e999affa373b -->|defined in| 92853cf6_4176_f03f_0670_cca3d63c003e
  386cc8d1_c4ff_6f53_715a_0c93b8a6e747["genAttrSegments()"]
  386cc8d1_c4ff_6f53_715a_0c93b8a6e747 -->|calls| 8ee2370a_436c_cb50_dd8a_e999affa373b
  1d03c177_581d_f577_3b0a_ad1fbb6de4ba["genDOMPropSegments()"]
  1d03c177_581d_f577_3b0a_ad1fbb6de4ba -->|calls| 8ee2370a_436c_cb50_dd8a_e999affa373b
  style 8ee2370a_436c_cb50_dd8a_e999affa373b 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, defined in packages/server-renderer/src/optimizing-compiler/modules.ts.
Where is genAttrSegment() defined?
genAttrSegment() is defined in packages/server-renderer/src/optimizing-compiler/modules.ts at line 56.
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