MCPcopy Index your code
hub / github.com/TruthHun/BookStack / updateDOMProps

Function updateDOMProps

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

Source from the content-addressed store, hash-verified

5908/* */
5909
5910function updateDOMProps (oldVnode, vnode) {
5911 if (!oldVnode.data.domProps && !vnode.data.domProps) {
5912 return
5913 }
5914 var key, cur;
5915 var elm = vnode.elm;
5916 var oldProps = oldVnode.data.domProps || {};
5917 var props = vnode.data.domProps || {};
5918 // clone observed objects, as the user probably wants to mutate it
5919 if (props.__ob__) {
5920 props = vnode.data.domProps = extend({}, props);
5921 }
5922
5923 for (key in oldProps) {
5924 if (props[key] == null) {
5925 elm[key] = '';
5926 }
5927 }
5928 for (key in props) {
5929 cur = props[key];
5930 // ignore children if the node has textContent or innerHTML,
5931 // as these will throw away existing DOM nodes and cause removal errors
5932 // on subsequent patches (#3360)
5933 if (key === 'textContent' || key === 'innerHTML') {
5934 if (vnode.children) { vnode.children.length = 0; }
5935 if (cur === oldProps[key]) { continue }
5936 }
5937
5938 if (key === 'value') {
5939 // store value as _value as well since
5940 // non-string values will be stringified
5941 elm._value = cur;
5942 // avoid resetting cursor position when value is the same
5943 var strCur = cur == null ? '' : String(cur);
5944 if (shouldUpdateValue(elm, vnode, strCur)) {
5945 elm.value = strCur;
5946 }
5947 } else {
5948 elm[key] = cur;
5949 }
5950 }
5951}
5952
5953// check platforms/web/util/attrs.js acceptValue
5954

Callers

nothing calls this directly

Calls 2

extendFunction · 0.70
shouldUpdateValueFunction · 0.70

Tested by

no test coverage detected