From: Evan You Date: Mon, 15 Jun 2020 15:08:55 +0000 (-0400) Subject: fix(compiler-core): ignore comment nodes in transition children X-Git-Tag: v3.0.0-beta.16~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e52b7cd7e7c10d8dbad92000ab3d5f2e02533e39;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-core): ignore comment nodes in transition children fix #1352 --- diff --git a/packages/compiler-dom/src/transforms/warnTransitionChildren.ts b/packages/compiler-dom/src/transforms/warnTransitionChildren.ts index 577b3a8876..c4347879fa 100644 --- a/packages/compiler-dom/src/transforms/warnTransitionChildren.ts +++ b/packages/compiler-dom/src/transforms/warnTransitionChildren.ts @@ -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)) )