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
  5c31f360_ac69_0a14_e083_68773e1a8fb7["renderAttrs()"]
  a78a83a4_53a3_a16a_7da6_646682fbc719["renderAttrs()"]
  a78a83a4_53a3_a16a_7da6_646682fbc719 -->|calls| 5c31f360_ac69_0a14_e083_68773e1a8fb7
  299f2646_f776_9b7d_1179_7b9087b1e66c["isUndef()"]
  5c31f360_ac69_0a14_e083_68773e1a8fb7 -->|calls| 299f2646_f776_9b7d_1179_7b9087b1e66c
  5b855538_2046_796e_16f9_7327a61399cb["isDef()"]
  5c31f360_ac69_0a14_e083_68773e1a8fb7 -->|calls| 5b855538_2046_796e_16f9_7327a61399cb
  133969d0_a7bd_f1c5_46a3_9fb8fd249583["extend()"]
  5c31f360_ac69_0a14_e083_68773e1a8fb7 -->|calls| 133969d0_a7bd_f1c5_46a3_9fb8fd249583
  36d518f0_47bc_38b2_b221_7b4f9bfce2a1["isSSRUnsafeAttr()"]
  5c31f360_ac69_0a14_e083_68773e1a8fb7 -->|calls| 36d518f0_47bc_38b2_b221_7b4f9bfce2a1
  37924a94_7eda_6738_f2fb_dc83c64098b0["renderAttr()"]
  5c31f360_ac69_0a14_e083_68773e1a8fb7 -->|calls| 37924a94_7eda_6738_f2fb_dc83c64098b0
  style 5c31f360_ac69_0a14_e083_68773e1a8fb7 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.
What does renderAttrs() call?
renderAttrs() calls 5 function(s): extend, isDef, isSSRUnsafeAttr, isUndef, 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