updateAttrs() — vue Function Reference
Architecture documentation for the updateAttrs() function in attrs.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 260c9082_4eba_7d9d_1e58_10f6149dde5e["updateAttrs()"] 5b855538_2046_796e_16f9_7327a61399cb["isDef()"] 260c9082_4eba_7d9d_1e58_10f6149dde5e -->|calls| 5b855538_2046_796e_16f9_7327a61399cb 299f2646_f776_9b7d_1179_7b9087b1e66c["isUndef()"] 260c9082_4eba_7d9d_1e58_10f6149dde5e -->|calls| 299f2646_f776_9b7d_1179_7b9087b1e66c c0051429_b95b_daa0_fc77_989c8344497d["isTrue()"] 260c9082_4eba_7d9d_1e58_10f6149dde5e -->|calls| c0051429_b95b_daa0_fc77_989c8344497d 133969d0_a7bd_f1c5_46a3_9fb8fd249583["extend()"] 260c9082_4eba_7d9d_1e58_10f6149dde5e -->|calls| 133969d0_a7bd_f1c5_46a3_9fb8fd249583 a13dc9cc_24b7_ee02_c711_52c1500ce296["setAttr()"] 260c9082_4eba_7d9d_1e58_10f6149dde5e -->|calls| a13dc9cc_24b7_ee02_c711_52c1500ce296 style 260c9082_4eba_7d9d_1e58_10f6149dde5e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/platforms/web/runtime/modules/attrs.ts lines 16–55
function updateAttrs(oldVnode: VNodeWithData, vnode: VNodeWithData) {
const opts = vnode.componentOptions
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
return
}
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
return
}
let key, cur, old
const elm = vnode.elm
const oldAttrs = oldVnode.data.attrs || {}
let attrs: any = vnode.data.attrs || {}
// clone observed objects, as the user probably wants to mutate it
if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) {
attrs = vnode.data.attrs = extend({}, attrs)
}
for (key in attrs) {
cur = attrs[key]
old = oldAttrs[key]
if (old !== cur) {
setAttr(elm, key, cur, vnode.data.pre)
}
}
// #4391: in IE9, setting type can reset value for input[type=radio]
// #6666: IE/Edge forces progress value down to 1 before setting a max
/* istanbul ignore if */
if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
setAttr(elm, 'value', attrs.value)
}
for (key in oldAttrs) {
if (isUndef(attrs[key])) {
if (isXlink(key)) {
elm.removeAttributeNS(xlinkNS, getXlinkProp(key))
} else if (!isEnumeratedAttr(key)) {
elm.removeAttribute(key)
}
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does updateAttrs() do?
updateAttrs() is a function in the vue codebase.
What does updateAttrs() call?
updateAttrs() calls 5 function(s): extend, isDef, isTrue, isUndef, setAttr.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free