]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf: avoid parentNode call when dynamic child is not a Fragment
authorEvan You <yyx990803@gmail.com>
Fri, 11 Oct 2019 22:06:24 +0000 (18:06 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 11 Oct 2019 22:06:24 +0000 (18:06 -0400)
packages/runtime-core/src/createRenderer.ts

index 2c836071ba62063f8d1b8a89f639c9c53694a41d..595b187ca887723e1064f80f0c2c8b002806d077 100644 (file)
@@ -503,7 +503,11 @@ export function createRenderer<
         patch(
           oldVNode,
           dynamicChildren[i],
-          hostParentNode(oldVNode.el!)!,
+          // in the case of a Fragment, we need to provide the actual parent
+          // of the Fragment itself so it can move its children. In other cases,
+          // the parent container is not actually used so we just pass the
+          // block element here to avoid a DOM parentNode call.
+          oldVNode.type === Fragment ? hostParentNode(oldVNode.el!)! : el,
           null,
           parentComponent,
           parentSuspense,