From 9761072d9302deac9c4fd3eefa98cc06b8fe3cb4 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 4 Oct 2017 10:23:51 -0400 Subject: [PATCH] refactor: rename variable --- src/core/vdom/patch.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/vdom/patch.js b/src/core/vdom/patch.js index 2918e621..65764b63 100644 --- a/src/core/vdom/patch.js +++ b/src/core/vdom/patch.js @@ -369,7 +369,7 @@ export function createPatchFunction (backend) { let newEndIdx = newCh.length - 1 let newStartVnode = newCh[0] let newEndVnode = newCh[newEndIdx] - let oldKeyToIdx, idxInOld, elmToMove, refElm + let oldKeyToIdx, idxInOld, vnodeToMove, refElm // removeOnly is a special flag used only by // to ensure removed elements stay in correct relative positions @@ -407,18 +407,18 @@ export function createPatchFunction (backend) { if (isUndef(idxInOld)) { // New element createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm) } else { - elmToMove = oldCh[idxInOld] + vnodeToMove = oldCh[idxInOld] /* istanbul ignore if */ - if (process.env.NODE_ENV !== 'production' && !elmToMove) { + if (process.env.NODE_ENV !== 'production' && !vnodeToMove) { warn( 'It seems there are duplicate keys that is causing an update error. ' + 'Make sure each v-for item has a unique key.' ) } - if (sameVnode(elmToMove, newStartVnode)) { - patchVnode(elmToMove, newStartVnode, insertedVnodeQueue) + if (sameVnode(vnodeToMove, newStartVnode)) { + patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue) oldCh[idxInOld] = undefined - canMove && nodeOps.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm) + canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm) } else { // same key but different element. treat as new element createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm)