MCPcopy
hub / github.com/fanmingming/live / updateAttrs

Function updateAttrs

m3u8/vue.js:6680–6719  ·  view source on GitHub ↗
(oldVnode, vnode)

Source from the content-addressed store, hash-verified

6678 /* */
6679
6680 function updateAttrs (oldVnode, vnode) {
6681 var opts = vnode.componentOptions;
6682 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6683 return
6684 }
6685 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6686 return
6687 }
6688 var key, cur, old;
6689 var elm = vnode.elm;
6690 var oldAttrs = oldVnode.data.attrs || {};
6691 var attrs = vnode.data.attrs || {};
6692 // clone observed objects, as the user probably wants to mutate it
6693 if (isDef(attrs.__ob__)) {
6694 attrs = vnode.data.attrs = extend({}, attrs);
6695 }
6696
6697 for (key in attrs) {
6698 cur = attrs[key];
6699 old = oldAttrs[key];
6700 if (old !== cur) {
6701 setAttr(elm, key, cur);
6702 }
6703 }
6704 // #4391: in IE9, setting type can reset value for input[type=radio]
6705 // #6666: IE/Edge forces progress value down to 1 before setting a max
6706 /* istanbul ignore if */
6707 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6708 setAttr(elm, 'value', attrs.value);
6709 }
6710 for (key in oldAttrs) {
6711 if (isUndef(attrs[key])) {
6712 if (isXlink(key)) {
6713 elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6714 } else if (!isEnumeratedAttr(key)) {
6715 elm.removeAttribute(key);
6716 }
6717 }
6718 }
6719 }
6720
6721 function setAttr (el, key, value) {
6722 if (el.tagName.indexOf('-') > -1) {

Callers

nothing calls this directly

Calls 6

isDefFunction · 0.85
isUndefFunction · 0.85
extendFunction · 0.85
setAttrFunction · 0.85
isXlinkFunction · 0.85
getXlinkPropFunction · 0.85

Tested by

no test coverage detected