From f59aef08e62576fd574b334510233e0f48198789 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 14 Feb 2017 15:47:28 -0500 Subject: [PATCH] further improve end tag check (close #4408) --- src/compiler/parser/html-parser.js | 4 +++- test/unit/features/directives/for.spec.js | 2 +- test/unit/modules/compiler/codegen.spec.js | 2 +- test/unit/modules/compiler/parser.spec.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compiler/parser/html-parser.js b/src/compiler/parser/html-parser.js index 6f64efa4ac..7d444ece14 100644 --- a/src/compiler/parser/html-parser.js +++ b/src/compiler/parser/html-parser.js @@ -277,7 +277,9 @@ export function parseHTML (html, options) { if (pos >= 0) { // Close all the open elements, up the stack for (let i = stack.length - 1; i >= pos; i--) { - if (process.env.NODE_ENV !== 'production' && i > pos && options.warn) { + if (process.env.NODE_ENV !== 'production' && + (i > pos || !tagName) && + options.warn) { options.warn( `tag <${stack[i].tag}> has no matching end tag.` ) diff --git a/test/unit/features/directives/for.spec.js b/test/unit/features/directives/for.spec.js index 8a0bcb2c15..89122abafe 100644 --- a/test/unit/features/directives/for.spec.js +++ b/test/unit/features/directives/for.spec.js @@ -449,7 +449,7 @@ describe('Directive v-for', () => { }, template: `
- {{ letter }}.{{ letter }}.
` }).$mount() diff --git a/test/unit/modules/compiler/codegen.spec.js b/test/unit/modules/compiler/codegen.spec.js index 21ad7fde36..52e196a8b7 100644 --- a/test/unit/modules/compiler/codegen.spec.js +++ b/test/unit/modules/compiler/codegen.spec.js @@ -200,7 +200,7 @@ describe('codegen', () => { ) // non input assertCodegen( - '

', + '

', `with(this){return _c('p',{attrs:{"value":msg}})}` ) }) diff --git a/test/unit/modules/compiler/parser.spec.js b/test/unit/modules/compiler/parser.spec.js index d923c73175..f37887edaf 100644 --- a/test/unit/modules/compiler/parser.spec.js +++ b/test/unit/modules/compiler/parser.spec.js @@ -248,7 +248,7 @@ describe('parser', () => { }) it('v-for directive iteration syntax', () => { - const ast = parse('