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

Function updateStyle

static/vuejs/vue.js:6090–6125  ·  view source on GitHub ↗
(oldVnode, vnode)

Source from the content-addressed store, hash-verified

6088});
6089
6090function updateStyle (oldVnode, vnode) {
6091 var data = vnode.data;
6092 var oldData = oldVnode.data;
6093
6094 if (!data.staticStyle && !data.style &&
6095 !oldData.staticStyle && !oldData.style) {
6096 return
6097 }
6098
6099 var cur, name;
6100 var el = vnode.elm;
6101 var oldStaticStyle = oldVnode.data.staticStyle;
6102 var oldStyleBinding = oldVnode.data.style || {};
6103
6104 // if static style exists, stylebinding already merged into it when doing normalizeStyleData
6105 var oldStyle = oldStaticStyle || oldStyleBinding;
6106
6107 var style = normalizeStyleBinding(vnode.data.style) || {};
6108
6109 vnode.data.style = style.__ob__ ? extend({}, style) : style;
6110
6111 var newStyle = getStyle(vnode, true);
6112
6113 for (name in oldStyle) {
6114 if (newStyle[name] == null) {
6115 setProp(el, name, '');
6116 }
6117 }
6118 for (name in newStyle) {
6119 cur = newStyle[name];
6120 if (cur !== oldStyle[name]) {
6121 // ie9 setting to null has no effect, must use empty string
6122 setProp(el, name, cur == null ? '' : cur);
6123 }
6124 }
6125}
6126
6127var style = {
6128 create: updateStyle,

Callers

nothing calls this directly

Calls 4

normalizeStyleBindingFunction · 0.70
extendFunction · 0.70
getStyleFunction · 0.70
setPropFunction · 0.70

Tested by

no test coverage detected