MCPcopy Create free account
hub / github.com/TruthHun/BookStack / updateAttrs

Function updateAttrs

static/vuejs/vue.esm.js:5243–5277  ·  view source on GitHub ↗
(oldVnode, vnode)

Source from the content-addressed store, hash-verified

5241/* */
5242
5243function updateAttrs (oldVnode, vnode) {
5244 if (!oldVnode.data.attrs && !vnode.data.attrs) {
5245 return
5246 }
5247 var key, cur, old;
5248 var elm = vnode.elm;
5249 var oldAttrs = oldVnode.data.attrs || {};
5250 var attrs = vnode.data.attrs || {};
5251 // clone observed objects, as the user probably wants to mutate it
5252 if (attrs.__ob__) {
5253 attrs = vnode.data.attrs = extend({}, attrs);
5254 }
5255
5256 for (key in attrs) {
5257 cur = attrs[key];
5258 old = oldAttrs[key];
5259 if (old !== cur) {
5260 setAttr(elm, key, cur);
5261 }
5262 }
5263 // #4391: in IE9, setting type can reset value for input[type=radio]
5264 /* istanbul ignore if */
5265 if (isIE9 && attrs.value !== oldAttrs.value) {
5266 setAttr(elm, 'value', attrs.value);
5267 }
5268 for (key in oldAttrs) {
5269 if (attrs[key] == null) {
5270 if (isXlink(key)) {
5271 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
5272 } else if (!isEnumeratedAttr(key)) {
5273 elm.removeAttribute(key);
5274 }
5275 }
5276 }
5277}
5278
5279function setAttr (el, key, value) {
5280 if (isBooleanAttr(key)) {

Callers

nothing calls this directly

Calls 4

extendFunction · 0.70
setAttrFunction · 0.70
isXlinkFunction · 0.70
getXlinkPropFunction · 0.70

Tested by

no test coverage detected