Skip to content

Commit e52b7cd

Browse files
committed
fix(compiler-core): ignore comment nodes in transition children
fix #1352
1 parent afb231e commit e52b7cd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@ export const warnTransitionChildren: NodeTransform = (node, context) => {
3434
}
3535

3636
function hasMultipleChildren(node: ComponentNode | IfBranchNode): boolean {
37-
const child = node.children[0]
37+
// #1352 filter out potential comment nodes.
38+
const children = (node.children = node.children.filter(
39+
c => c.type !== NodeTypes.COMMENT
40+
))
41+
const child = children[0]
3842
return (
39-
node.children.length !== 1 ||
43+
children.length !== 1 ||
4044
child.type === NodeTypes.FOR ||
4145
(child.type === NodeTypes.IF && child.branches.some(hasMultipleChildren))
4246
)

0 commit comments

Comments
 (0)