updateAttrs() — vue Function Reference
Architecture documentation for the updateAttrs() function in attrs.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 680592c8_1c16_02fb_0095_5b9bfc426622["updateAttrs()"] c25982c8_2ef6_052e_8f6b_374c617a6efc["attrs.ts"] 680592c8_1c16_02fb_0095_5b9bfc426622 -->|defined in| c25982c8_2ef6_052e_8f6b_374c617a6efc dd3dbfa6_5933_1dab_3be6_41a5ba041cab["setAttr()"] 680592c8_1c16_02fb_0095_5b9bfc426622 -->|calls| dd3dbfa6_5933_1dab_3be6_41a5ba041cab style 680592c8_1c16_02fb_0095_5b9bfc426622 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