MCPcopy
hub / github.com/fanmingming/live / patchVnode

Function patchVnode

m3u8/vue.js:6252–6325  ·  view source on GitHub ↗
(
      oldVnode,
      vnode,
      insertedVnodeQueue,
      ownerArray,
      index,
      removeOnly
    )

Source from the content-addressed store, hash-verified

6250 }
6251
6252 function patchVnode (
6253 oldVnode,
6254 vnode,
6255 insertedVnodeQueue,
6256 ownerArray,
6257 index,
6258 removeOnly
6259 ) {
6260 if (oldVnode === vnode) {
6261 return
6262 }
6263
6264 if (isDef(vnode.elm) && isDef(ownerArray)) {
6265 // clone reused vnode
6266 vnode = ownerArray[index] = cloneVNode(vnode);
6267 }
6268
6269 var elm = vnode.elm = oldVnode.elm;
6270
6271 if (isTrue(oldVnode.isAsyncPlaceholder)) {
6272 if (isDef(vnode.asyncFactory.resolved)) {
6273 hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6274 } else {
6275 vnode.isAsyncPlaceholder = true;
6276 }
6277 return
6278 }
6279
6280 // reuse element for static trees.
6281 // note we only do this if the vnode is cloned -
6282 // if the new node is not cloned it means the render functions have been
6283 // reset by the hot-reload-api and we need to do a proper re-render.
6284 if (isTrue(vnode.isStatic) &&
6285 isTrue(oldVnode.isStatic) &&
6286 vnode.key === oldVnode.key &&
6287 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
6288 ) {
6289 vnode.componentInstance = oldVnode.componentInstance;
6290 return
6291 }
6292
6293 var i;
6294 var data = vnode.data;
6295 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6296 i(oldVnode, vnode);
6297 }
6298
6299 var oldCh = oldVnode.children;
6300 var ch = vnode.children;
6301 if (isDef(data) && isPatchable(vnode)) {
6302 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
6303 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
6304 }
6305 if (isUndef(vnode.text)) {
6306 if (isDef(oldCh) && isDef(ch)) {
6307 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
6308 } else if (isDef(ch)) {
6309 {

Callers 2

updateChildrenFunction · 0.85
createPatchFunctionFunction · 0.85

Calls 11

isDefFunction · 0.85
cloneVNodeFunction · 0.85
isTrueFunction · 0.85
hydrateFunction · 0.85
isPatchableFunction · 0.85
isUndefFunction · 0.85
updateChildrenFunction · 0.85
checkDuplicateKeysFunction · 0.85
addVnodesFunction · 0.85
removeVnodesFunction · 0.85
iFunction · 0.50

Tested by

no test coverage detected