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

Function updateStyle

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

Source from the content-addressed store, hash-verified

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