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

Function updateAttrs

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

Source from the content-addressed store, hash-verified

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