fix(compiler-core): ignore comment nodes in transition children
fix #1352
This commit is contained in:
parent
afb231ec5c
commit
e52b7cd7e7
@ -34,9 +34,13 @@ export const warnTransitionChildren: NodeTransform = (node, context) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hasMultipleChildren(node: ComponentNode | IfBranchNode): boolean {
|
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 (
|
return (
|
||||||
node.children.length !== 1 ||
|
children.length !== 1 ||
|
||||||
child.type === NodeTypes.FOR ||
|
child.type === NodeTypes.FOR ||
|
||||||
(child.type === NodeTypes.IF && child.branches.some(hasMultipleChildren))
|
(child.type === NodeTypes.IF && child.branches.some(hasMultipleChildren))
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user