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
  a0b4404b_fb84_98b3_4f7a_375b041a7128["renderAttrs()"]
  431f70cc_3eff_e6e1_c18a_d3173ac7370f["renderAttrs()"]
  431f70cc_3eff_e6e1_c18a_d3173ac7370f -->|calls| a0b4404b_fb84_98b3_4f7a_375b041a7128
  a1f5b8ca_b6d5_6b24_155e_038685c97c85["isUndef()"]
  a0b4404b_fb84_98b3_4f7a_375b041a7128 -->|calls| a1f5b8ca_b6d5_6b24_155e_038685c97c85
  2be3818d_a4f3_495c_543c_ee071b428982["isDef()"]
  a0b4404b_fb84_98b3_4f7a_375b041a7128 -->|calls| 2be3818d_a4f3_495c_543c_ee071b428982
  7a0093e3_a58a_af71_971f_488b65897e74["extend()"]
  a0b4404b_fb84_98b3_4f7a_375b041a7128 -->|calls| 7a0093e3_a58a_af71_971f_488b65897e74
  cb42e4b3_e1a0_95d1_b1c5_765852d601cc["isSSRUnsafeAttr()"]
  a0b4404b_fb84_98b3_4f7a_375b041a7128 -->|calls| cb42e4b3_e1a0_95d1_b1c5_765852d601cc
  5a73be1a_07f5_5a0a_d729_edcdc84b830c["renderAttr()"]
  a0b4404b_fb84_98b3_4f7a_375b041a7128 -->|calls| 5a73be1a_07f5_5a0a_d729_edcdc84b830c
  style a0b4404b_fb84_98b3_4f7a_375b041a7128 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