diff --git a/src/compiler/codegen/index.js b/src/compiler/codegen/index.js index ac7740500..3a0d20c9d 100644 --- a/src/compiler/codegen/index.js +++ b/src/compiler/codegen/index.js @@ -298,14 +298,18 @@ function genChildren (el: ASTElement, checkSkip?: boolean): string | void { function canSkipNormalization (children): boolean { for (let i = 0; i < children.length; i++) { const el: any = children[i] - if (el.for || el.tag === 'template' || el.tag === 'slot' || - (el.if && el.ifConditions.some(c => c.tag === 'template'))) { + if (needsNormalization(el) || + (el.if && el.ifConditions.some(c => needsNormalization(c.block)))) { return false } } return true } +function needsNormalization (el) { + return el.for || el.tag === 'template' || el.tag === 'slot' +} + function genNode (node: ASTNode) { if (node.type === 1) { return genElement(node) diff --git a/test/unit/features/directives/if.spec.js b/test/unit/features/directives/if.spec.js index 69d751c17..458f1f924 100644 --- a/test/unit/features/directives/if.spec.js +++ b/test/unit/features/directives/if.spec.js @@ -141,7 +141,7 @@ describe('Directive v-if', () => { const vm = new Vue({ template: `