Skip to content

Commit

Permalink
further improve end tag check (close #4408)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Feb 14, 2017
1 parent 0201d8c commit f59aef0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/compiler/parser/html-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/features/directives/for.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ describe('Directive v-for', () => {
},
template: `
<div>
<span v-for="letter in text">{{ letter }}.</span
<span v-for="letter in text">{{ letter }}.</span>
</div>
`
}).$mount()
Expand Down
2 changes: 1 addition & 1 deletion test/unit/modules/compiler/codegen.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe('codegen', () => {
)
// non input
assertCodegen(
'<p :value="msg">',
'<p :value="msg"/>',
`with(this){return _c('p',{attrs:{"value":msg}})}`
)
})
Expand Down
2 changes: 1 addition & 1 deletion test/unit/modules/compiler/parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ describe('parser', () => {
})

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

0 comments on commit f59aef0

Please sign in to comment.