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

Function patchVnode

static/vuejs/vue.runtime.esm.js:4900–4945  ·  view source on GitHub ↗
(oldVnode, vnode, insertedVnodeQueue, removeOnly)

Source from the content-addressed store, hash-verified

4898 }
4899
4900 function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
4901 if (oldVnode === vnode) {
4902 return
4903 }
4904 // reuse element for static trees.
4905 // note we only do this if the vnode is cloned -
4906 // if the new node is not cloned it means the render functions have been
4907 // reset by the hot-reload-api and we need to do a proper re-render.
4908 if (isTrue(vnode.isStatic) &&
4909 isTrue(oldVnode.isStatic) &&
4910 vnode.key === oldVnode.key &&
4911 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
4912 vnode.elm = oldVnode.elm;
4913 vnode.componentInstance = oldVnode.componentInstance;
4914 return
4915 }
4916 var i;
4917 var data = vnode.data;
4918 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
4919 i(oldVnode, vnode);
4920 }
4921 var elm = vnode.elm = oldVnode.elm;
4922 var oldCh = oldVnode.children;
4923 var ch = vnode.children;
4924 if (isDef(data) && isPatchable(vnode)) {
4925 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
4926 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
4927 }
4928 if (isUndef(vnode.text)) {
4929 if (isDef(oldCh) && isDef(ch)) {
4930 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
4931 } else if (isDef(ch)) {
4932 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
4933 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
4934 } else if (isDef(oldCh)) {
4935 removeVnodes(elm, oldCh, 0, oldCh.length - 1);
4936 } else if (isDef(oldVnode.text)) {
4937 nodeOps.setTextContent(elm, '');
4938 }
4939 } else if (oldVnode.text !== vnode.text) {
4940 nodeOps.setTextContent(elm, vnode.text);
4941 }
4942 if (isDef(data)) {
4943 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
4944 }
4945 }
4946
4947 function invokeInsertHook (vnode, queue, initial) {
4948 // delay insert hooks for component root nodes, invoke them after the

Callers 2

updateChildrenFunction · 0.70
createPatchFunctionFunction · 0.70

Calls 8

isTrueFunction · 0.70
isDefFunction · 0.70
iFunction · 0.70
isPatchableFunction · 0.70
isUndefFunction · 0.70
updateChildrenFunction · 0.70
addVnodesFunction · 0.70
removeVnodesFunction · 0.70

Tested by

no test coverage detected