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

Function patchVnode

static/vuejs/vue.runtime.common.js:4902–4947  ·  view source on GitHub ↗
(oldVnode, vnode, insertedVnodeQueue, removeOnly)

Source from the content-addressed store, hash-verified

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