refactor(compiler): refine CDATA endTokens (#4459)

This commit is contained in:
Herrington Darkholme 2021-09-02 04:43:10 +08:00 committed by GitHub
parent 7178716b4c
commit 4502a0eab5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -989,10 +989,8 @@ function parseInterpolation(
function parseText(context: ParserContext, mode: TextModes): TextNode {
__TEST__ && assert(context.source.length > 0)
const endTokens = ['<', context.options.delimiters[0]]
if (mode === TextModes.CDATA) {
endTokens.push(']]>')
}
const endTokens =
mode === TextModes.CDATA ? [']]>'] : ['<', context.options.delimiters[0]]
let endIndex = context.source.length
for (let i = 0; i < endTokens.length; i++) {