Home / Function/ renderAttrs() — vue Function Reference

renderAttrs() — vue Function Reference

Architecture documentation for the renderAttrs() function in attrs.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  92fc9f25_c027_0fc7_6467_0fb55d262ccb["renderAttrs()"]
  f549c274_b375_8785_e025_a5d238ba23a1["attrs.ts"]
  92fc9f25_c027_0fc7_6467_0fb55d262ccb -->|defined in| f549c274_b375_8785_e025_a5d238ba23a1
  0dfeeed0_755a_0abd_c5dc_f0654ad8214f["renderAttrs()"]
  0dfeeed0_755a_0abd_c5dc_f0654ad8214f -->|calls| 92fc9f25_c027_0fc7_6467_0fb55d262ccb
  47f8c312_7314_9cbf_cfdb_5b24401f4a11["isSSRUnsafeAttr()"]
  92fc9f25_c027_0fc7_6467_0fb55d262ccb -->|calls| 47f8c312_7314_9cbf_cfdb_5b24401f4a11
  d3df2209_4d64_4591_abc3_5711006984d0["renderAttr()"]
  92fc9f25_c027_0fc7_6467_0fb55d262ccb -->|calls| d3df2209_4d64_4591_abc3_5711006984d0
  style 92fc9f25_c027_0fc7_6467_0fb55d262ccb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/modules/attrs.ts lines 15–52

export default function renderAttrs(node: VNodeWithData): string {
  let attrs = node.data.attrs
  let res = ''

  const opts = node.parent && node.parent.componentOptions
  if (isUndef(opts) || opts.Ctor.options.inheritAttrs !== false) {
    let parent = node.parent
    while (isDef(parent)) {
      // Stop fallthrough in case parent has inheritAttrs option set to false
      if (
        parent.componentOptions &&
        parent.componentOptions.Ctor.options.inheritAttrs === false
      ) {
        break
      }
      if (isDef(parent.data) && isDef(parent.data.attrs)) {
        attrs = extend(extend({}, attrs), parent.data.attrs)
      }
      parent = parent.parent
    }
  }

  if (isUndef(attrs)) {
    return res
  }

  for (const key in attrs) {
    if (isSSRUnsafeAttr(key)) {
      continue
    }
    if (key === 'style') {
      // leave it to the style module
      continue
    }
    res += renderAttr(key, attrs[key])
  }
  return res
}

Subdomains

Called By

Frequently Asked Questions

What does renderAttrs() do?
renderAttrs() is a function in the vue codebase, defined in packages/server-renderer/src/modules/attrs.ts.
Where is renderAttrs() defined?
renderAttrs() is defined in packages/server-renderer/src/modules/attrs.ts at line 15.
What does renderAttrs() call?
renderAttrs() calls 2 function(s): isSSRUnsafeAttr, renderAttr.
What calls renderAttrs()?
renderAttrs() is called by 1 function(s): renderAttrs.

Analyze Your Own Codebase

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

Try Supermodel Free