Skip to content

Commit

Permalink
fix(compiler-core): ignore comment nodes in transition children
Browse files Browse the repository at this point in the history
fix #1352
  • Loading branch information
yyx990803 committed Jun 15, 2020
1 parent afb231e commit e52b7cd
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
Expand Down

0 comments on commit e52b7cd

Please sign in to comment.