From a984d3a53132dd54f49129266b5c064f00be7f89 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 2 Dec 2019 15:49:59 -0500 Subject: [PATCH] test: skip optimizing single text root --- .../compiler-core/src/transforms/transformText.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/compiler-core/src/transforms/transformText.ts b/packages/compiler-core/src/transforms/transformText.ts index 91d5d5076a..3cc7518a8b 100644 --- a/packages/compiler-core/src/transforms/transformText.ts +++ b/packages/compiler-core/src/transforms/transformText.ts @@ -56,12 +56,14 @@ export const transformText: NodeTransform = (node, context) => { if ( !hasText || - // if this is a plain element with a single text child, leave it as-is - // since the runtime has dedicated fast path for this by directly + // if this is a plain element with a single text child, leave it + // as-is since the runtime has dedicated fast path for this by directly // setting textContent of the element. - (node.type === NodeTypes.ELEMENT && - node.tagType === ElementTypes.ELEMENT && - children.length === 1) + // for component root it's always normalized anyway. + (children.length === 1 && + (node.type === NodeTypes.ROOT || + (node.type === NodeTypes.ELEMENT && + node.tagType === ElementTypes.ELEMENT))) ) { return } -- 2.47.3