@@ -168,8 +168,8 @@ export function parseHTML (html, options) {
parseEndTag(stackedTag, index - endTagLength, index)
}
- if (html === last && options.chars) {
- options.chars(html)
+ if (html === last) {
+ options.chars && options.chars(html)
break
@@ -150,4 +150,9 @@ describe('Single File Component parser', () => {
const res = parseComponent(`<template>${raw}</template>`)
expect(res.template.content.trim()).toBe(raw)
})
+
+ it('should not hang on trailing text', () => {
+ const res = parseComponent(`<template>hi</`)
+ expect(res.template.content).toBe('hi')
+ })