]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-core): ignore comment nodes in transition children
authorEvan You <yyx990803@gmail.com>
Mon, 15 Jun 2020 15:08:55 +0000 (11:08 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 15 Jun 2020 15:08:55 +0000 (11:08 -0400)
fix #1352

packages/compiler-dom/src/transforms/warnTransitionChildren.ts

index 577b3a8876ffabf11083cf693ad46c59169d9182..c4347879fadd9bc0188797c80857e436d9879ef5 100644 (file)
@@ -34,9 +34,13 @@ export const warnTransitionChildren: NodeTransform = (node, context) => {
 }
 
 function hasMultipleChildren(node: ComponentNode | IfBranchNode): boolean {
-  const child = node.children[0]
+  // #1352 filter out potential comment nodes.
+  const children = (node.children = node.children.filter(
+    c => c.type !== NodeTypes.COMMENT
+  ))
+  const child = children[0]
   return (
-    node.children.length !== 1 ||
+    children.length !== 1 ||
     child.type === NodeTypes.FOR ||
     (child.type === NodeTypes.IF && child.branches.some(hasMultipleChildren))
   )