Skip to content

Commit

Permalink
fix(sfc): component contains '<' only (#4753)
Browse files Browse the repository at this point in the history
* fix(sfc): component contains '<' only

* update based on reviews
  • Loading branch information
dhcmrlchtdj authored and yyx990803 committed Jan 20, 2017
1 parent 9e38abc commit 938fa4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/parser/html-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function parseHTML (html, options) {
}

let text, rest, next
if (textEnd > 0) {
if (textEnd >= 0) {
rest = html.slice(textEnd)
while (
!endTag.test(rest) &&
Expand Down
9 changes: 9 additions & 0 deletions test/unit/modules/sfc/sfc-parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ describe('Single File Component parser', () => {
expect(res.template.content.trim()).toBe(`div\n h1(v-if='1 < 2') hello`)
})

it('should handle component contains "<" only', () => {
const res = parseComponent(`
<template>
<span><</span>
</template>
`)
expect(res.template.content.trim()).toBe(`<span><</span>`)
})

it('should handle custom blocks without parsing them', () => {
const res = parseComponent(`
<template>
Expand Down

0 comments on commit 938fa4e

Please sign in to comment.