From a3c345d5ca803fb9060bec100bbb0f5dceb7b6fb Mon Sep 17 00:00:00 2001 From: creeperyang Date: Sun, 30 Jul 2017 10:58:29 +0800 Subject: [PATCH] [code:snabbdom] fix `updateChildren` error Refs: https://github.com/creeperyang/blog/issues/33#issuecomment-318817815 --- codes/snabbdom/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codes/snabbdom/src/index.js b/codes/snabbdom/src/index.js index e607f8a..5f6ab23 100644 --- a/codes/snabbdom/src/index.js +++ b/codes/snabbdom/src/index.js @@ -292,7 +292,7 @@ export default function init(modules = [], domApi) { else if (isSameVnode(oldEndVnode, newStartVnode)) { patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue) // 这里是左移更新后的 dom,原因参考上面的右移。 - api.insertBefore(parentElm, oldEndVnode.elm, api.nextSibling(oldStartVnode.elm)) + api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm) oldEndVnode = oldCh[--oldEndIdx] newStartVnode = newCh[++newStartIdx] }