fix(compiler-dom): fix transition children check for whitespace nodes

fix #4637
This commit is contained in:
Evan You 2021-09-21 12:25:05 -04:00
parent d23fde3d3b
commit ed6470c845

View File

@ -36,7 +36,9 @@ export const warnTransitionChildren: NodeTransform = (node, context) => {
function hasMultipleChildren(node: ComponentNode | IfBranchNode): boolean { function hasMultipleChildren(node: ComponentNode | IfBranchNode): boolean {
// #1352 filter out potential comment nodes. // #1352 filter out potential comment nodes.
const children = (node.children = node.children.filter( const children = (node.children = node.children.filter(
c => c.type !== NodeTypes.COMMENT c =>
c.type !== NodeTypes.COMMENT &&
!(c.type === NodeTypes.TEXT && !c.content.trim())
)) ))
const child = children[0] const child = children[0]
return ( return (