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

Function updateAttrs

static/vuejs/vue.runtime.common.js:5241–5275  ·  view source on GitHub ↗
(oldVnode, vnode)

Source from the content-addressed store, hash-verified

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