From: Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com> Date: Wed, 1 Sep 2021 20:43:10 +0000 (+0800) Subject: refactor(compiler): refine CDATA endTokens (#4459) X-Git-Tag: v3.2.7~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4502a0eab5f7c5a0595304c406ba60f566b281da;p=thirdparty%2Fvuejs%2Fcore.git refactor(compiler): refine CDATA endTokens (#4459) --- diff --git a/packages/compiler-core/src/parse.ts b/packages/compiler-core/src/parse.ts index 310766347e..21973878db 100644 --- a/packages/compiler-core/src/parse.ts +++ b/packages/compiler-core/src/parse.ts @@ -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++) {