Skip to content

Commit f59aef0

Browse files
committed
further improve end tag check (close #4408)
1 parent 0201d8c commit f59aef0

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

Diff for: src/compiler/parser/html-parser.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ export function parseHTML (html, options) {
277277
if (pos >= 0) {
278278
// Close all the open elements, up the stack
279279
for (let i = stack.length - 1; i >= pos; i--) {
280-
if (process.env.NODE_ENV !== 'production' && i > pos && options.warn) {
280+
if (process.env.NODE_ENV !== 'production' &&
281+
(i > pos || !tagName) &&
282+
options.warn) {
281283
options.warn(
282284
`tag <${stack[i].tag}> has no matching end tag.`
283285
)

Diff for: test/unit/features/directives/for.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ describe('Directive v-for', () => {
449449
},
450450
template: `
451451
<div>
452-
<span v-for="letter in text">{{ letter }}.</span
452+
<span v-for="letter in text">{{ letter }}.</span>
453453
</div>
454454
`
455455
}).$mount()

Diff for: test/unit/modules/compiler/codegen.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ describe('codegen', () => {
200200
)
201201
// non input
202202
assertCodegen(
203-
'<p :value="msg">',
203+
'<p :value="msg"/>',
204204
`with(this){return _c('p',{attrs:{"value":msg}})}`
205205
)
206206
})

Diff for: test/unit/modules/compiler/parser.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ describe('parser', () => {
248248
})
249249

250250
it('v-for directive iteration syntax', () => {
251-
const ast = parse('<ul><li v-for="(item, index) in items"></li><ul/>', baseOptions)
251+
const ast = parse('<ul><li v-for="(item, index) in items"></li></ul>', baseOptions)
252252
const liAst = ast.children[0]
253253
expect(liAst.for).toBe('items')
254254
expect(liAst.alias).toBe('item')

0 commit comments

Comments
 (0)