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

Function updateAttrs

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

Source from the content-addressed store, hash-verified

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