fix(compiler-core): should only parse interpolations in DATA text mode
This commit is contained in:
parent
5cd1495767
commit
95b2cb6fd2
@ -117,10 +117,11 @@ function parseChildren(
|
||||
const s = context.source
|
||||
let node: TemplateChildNode | TemplateChildNode[] | undefined = undefined
|
||||
|
||||
if (mode === TextModes.DATA) {
|
||||
if (!context.inPre && startsWith(s, context.options.delimiters[0])) {
|
||||
// '{{'
|
||||
node = parseInterpolation(context, mode)
|
||||
} else if (mode === TextModes.DATA && s[0] === '<') {
|
||||
} else if (s[0] === '<') {
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
|
||||
if (s.length === 1) {
|
||||
emitError(context, ErrorCodes.EOF_BEFORE_TAG_NAME, 1)
|
||||
@ -155,7 +156,11 @@ function parseChildren(
|
||||
parseTag(context, TagType.End, parent)
|
||||
continue
|
||||
} else {
|
||||
emitError(context, ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME, 2)
|
||||
emitError(
|
||||
context,
|
||||
ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
|
||||
2
|
||||
)
|
||||
node = parseBogusComment(context)
|
||||
}
|
||||
} else if (/[a-z]/i.test(s[1])) {
|
||||
@ -171,6 +176,7 @@ function parseChildren(
|
||||
emitError(context, ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!node) {
|
||||
node = parseText(context, mode)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user