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

Function updateAttrs

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

Source from the content-addressed store, hash-verified

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