From: Ayush Goyal Date: Fri, 25 Oct 2019 14:35:44 +0000 (+0530) Subject: perf(compiler-dom): use makeMap instead of RegEx (#354) X-Git-Tag: v3.0.0-alpha.0~308 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a489f98a6625fbd61067e2d4721c1204bd22ea45;p=thirdparty%2Fvuejs%2Fcore.git perf(compiler-dom): use makeMap instead of RegEx (#354) --- diff --git a/packages/compiler-dom/src/parserOptionsMinimal.ts b/packages/compiler-dom/src/parserOptionsMinimal.ts index 38b3e6a834..09cbcb0d7d 100644 --- a/packages/compiler-dom/src/parserOptionsMinimal.ts +++ b/packages/compiler-dom/src/parserOptionsMinimal.ts @@ -6,6 +6,12 @@ import { NodeTypes } from '@vue/compiler-core' import { isVoidTag, isHTMLTag, isSVGTag } from './tagConfig' +import { makeMap } from '@vue/shared' + +const isRawTextContainer = /*#__PURE__*/ makeMap( + 'style,iframe,script,noscript', + true +) export const enum DOMNamespaces { HTML = Namespaces.HTML, @@ -73,9 +79,7 @@ export const parserOptionsMinimal: ParserOptions = { if (tag === 'textarea' || tag === 'title') { return TextModes.RCDATA } - if ( - /^(?:style|xmp|iframe|noembed|noframes|script|noscript)$/i.test(tag) - ) { + if (isRawTextContainer(tag)) { return TextModes.RAWTEXT } }