updateAttrs() — vue Function Reference
Architecture documentation for the updateAttrs() function in attrs.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD a0aca0ca_c52c_4a74_dca5_c7f2b48367cb["updateAttrs()"] 79ac8337_fd93_af91_1c63_9d155d74dbf5["attrs.ts"] a0aca0ca_c52c_4a74_dca5_c7f2b48367cb -->|defined in| 79ac8337_fd93_af91_1c63_9d155d74dbf5 ba2408c9_3afc_6948_9503_46554375131e["setAttr()"] a0aca0ca_c52c_4a74_dca5_c7f2b48367cb -->|calls| ba2408c9_3afc_6948_9503_46554375131e style a0aca0ca_c52c_4a74_dca5_c7f2b48367cb 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
Defined In
Calls
Source
Frequently Asked Questions
What does updateAttrs() do?
updateAttrs() is a function in the vue codebase, defined in src/platforms/web/runtime/modules/attrs.ts.
Where is updateAttrs() defined?
updateAttrs() is defined in src/platforms/web/runtime/modules/attrs.ts at line 16.
What does updateAttrs() call?
updateAttrs() calls 1 function(s): setAttr.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free