Home / Function/ setAttr() — vue Function Reference

setAttr() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ba2408c9_3afc_6948_9503_46554375131e["setAttr()"]
  79ac8337_fd93_af91_1c63_9d155d74dbf5["attrs.ts"]
  ba2408c9_3afc_6948_9503_46554375131e -->|defined in| 79ac8337_fd93_af91_1c63_9d155d74dbf5
  a0aca0ca_c52c_4a74_dca5_c7f2b48367cb["updateAttrs()"]
  a0aca0ca_c52c_4a74_dca5_c7f2b48367cb -->|calls| ba2408c9_3afc_6948_9503_46554375131e
  0c2c456e_5db1_3b87_8b40_2e5fe4c21313["baseSetAttr()"]
  ba2408c9_3afc_6948_9503_46554375131e -->|calls| 0c2c456e_5db1_3b87_8b40_2e5fe4c21313
  style ba2408c9_3afc_6948_9503_46554375131e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/platforms/web/runtime/modules/attrs.ts lines 57–82

function setAttr(el: Element, key: string, value: any, isInPre?: any) {
  if (isInPre || el.tagName.indexOf('-') > -1) {
    baseSetAttr(el, key, value)
  } else if (isBooleanAttr(key)) {
    // set attribute for blank value
    // e.g. <option disabled>Select one</option>
    if (isFalsyAttrValue(value)) {
      el.removeAttribute(key)
    } else {
      // technically allowfullscreen is a boolean attribute for <iframe>,
      // but Flash expects a value of "true" when used on <embed> tag
      value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key
      el.setAttribute(key, value)
    }
  } else if (isEnumeratedAttr(key)) {
    el.setAttribute(key, convertEnumeratedValue(key, value))
  } else if (isXlink(key)) {
    if (isFalsyAttrValue(value)) {
      el.removeAttributeNS(xlinkNS, getXlinkProp(key))
    } else {
      el.setAttributeNS(xlinkNS, key, value)
    }
  } else {
    baseSetAttr(el, key, value)
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does setAttr() do?
setAttr() is a function in the vue codebase, defined in src/platforms/web/runtime/modules/attrs.ts.
Where is setAttr() defined?
setAttr() is defined in src/platforms/web/runtime/modules/attrs.ts at line 57.
What does setAttr() call?
setAttr() calls 1 function(s): baseSetAttr.
What calls setAttr()?
setAttr() is called by 1 function(s): updateAttrs.

Analyze Your Own Codebase

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

Try Supermodel Free