Home / Function/ processAttrs() — vue Function Reference

processAttrs() — vue Function Reference

Architecture documentation for the processAttrs() function in index.ts from the vue codebase.

Function typescript VueCore GlobalAPI calls 9 called by 1

Entity Profile

Dependency Diagram

graph TD
  89ae2d84_ca61_4847_7313_0974c1948730["processAttrs()"]
  101d3d34_ac07_228f_62b9_5d5ac4a0ea2e["index.ts"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|defined in| 101d3d34_ac07_228f_62b9_5d5ac4a0ea2e
  08093d1f_a003_dbad_063e_2431482be94f["processElement()"]
  08093d1f_a003_dbad_063e_2431482be94f -->|calls| 89ae2d84_ca61_4847_7313_0974c1948730
  1fbc98da_1a21_e567_0590_0afa3750d60f["parseModifiers()"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|calls| 1fbc98da_1a21_e567_0590_0afa3750d60f
  b4977dfa_c8a9_400f_00e1_dac785ffde86["parseFilters()"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|calls| b4977dfa_c8a9_400f_00e1_dac785ffde86
  bf9ddf1c_ef97_a050_8f03_7e20fe6e8f1c["genAssignmentCode()"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|calls| bf9ddf1c_ef97_a050_8f03_7e20fe6e8f1c
  05f74cc7_40db_04f6_e28a_3603fb1c7fdc["addHandler()"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|calls| 05f74cc7_40db_04f6_e28a_3603fb1c7fdc
  b79f39a8_390a_fde9_c932_cc95d1f309cf["addProp()"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|calls| b79f39a8_390a_fde9_c932_cc95d1f309cf
  728112a4_3e04_adaf_9ed8_659dd3281218["addAttr()"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|calls| 728112a4_3e04_adaf_9ed8_659dd3281218
  e0310396_cbb9_4116_648d_3af0bd606c42["addDirective()"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|calls| e0310396_cbb9_4116_648d_3af0bd606c42
  933c2dfe_2a12_48de_3a97_4aec1fcd7fca["checkForAliasModel()"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|calls| 933c2dfe_2a12_48de_3a97_4aec1fcd7fca
  2ed64a28_b078_3038_149f_d30cf6867ba3["parseText()"]
  89ae2d84_ca61_4847_7313_0974c1948730 -->|calls| 2ed64a28_b078_3038_149f_d30cf6867ba3
  style 89ae2d84_ca61_4847_7313_0974c1948730 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/compiler/parser/index.ts lines 773–920

function processAttrs(el) {
  const list = el.attrsList
  let i, l, name, rawName, value, modifiers, syncGen, isDynamic
  for (i = 0, l = list.length; i < l; i++) {
    name = rawName = list[i].name
    value = list[i].value
    if (dirRE.test(name)) {
      // mark element as dynamic
      el.hasBindings = true
      // modifiers
      modifiers = parseModifiers(name.replace(dirRE, ''))
      // support .foo shorthand syntax for the .prop modifier
      if (process.env.VBIND_PROP_SHORTHAND && propBindRE.test(name)) {
        ;(modifiers || (modifiers = {})).prop = true
        name = `.` + name.slice(1).replace(modifierRE, '')
      } else if (modifiers) {
        name = name.replace(modifierRE, '')
      }
      if (bindRE.test(name)) {
        // v-bind
        name = name.replace(bindRE, '')
        value = parseFilters(value)
        isDynamic = dynamicArgRE.test(name)
        if (isDynamic) {
          name = name.slice(1, -1)
        }
        if (__DEV__ && value.trim().length === 0) {
          warn(
            `The value for a v-bind expression cannot be empty. Found in "v-bind:${name}"`
          )
        }
        if (modifiers) {
          if (modifiers.prop && !isDynamic) {
            name = camelize(name)
            if (name === 'innerHtml') name = 'innerHTML'
          }
          if (modifiers.camel && !isDynamic) {
            name = camelize(name)
          }
          if (modifiers.sync) {
            syncGen = genAssignmentCode(value, `$event`)
            if (!isDynamic) {
              addHandler(
                el,
                `update:${camelize(name)}`,
                syncGen,
                null,
                false,
                warn,
                list[i]
              )
              if (hyphenate(name) !== camelize(name)) {
                addHandler(
                  el,
                  `update:${hyphenate(name)}`,
                  syncGen,
                  null,
                  false,
                  warn,
                  list[i]
                )
              }
            } else {
              // handler w/ dynamic event name
              addHandler(
                el,
                `"update:"+(${name})`,
                syncGen,
                null,
                false,
                warn,
                list[i],
                true // dynamic
              )
            }
          }
        }
        if (
          (modifiers && modifiers.prop) ||
          (!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name))
        ) {

Domain

Subdomains

Called By

Frequently Asked Questions

What does processAttrs() do?
processAttrs() is a function in the vue codebase, defined in src/compiler/parser/index.ts.
Where is processAttrs() defined?
processAttrs() is defined in src/compiler/parser/index.ts at line 773.
What does processAttrs() call?
processAttrs() calls 9 function(s): addAttr, addDirective, addHandler, addProp, checkForAliasModel, genAssignmentCode, parseFilters, parseModifiers, and 1 more.
What calls processAttrs()?
processAttrs() is called by 1 function(s): processElement.

Analyze Your Own Codebase

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

Try Supermodel Free