]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf(compiler-dom): use makeMap instead of RegEx (#354)
authorAyush Goyal <ayush987goyal@gmail.com>
Fri, 25 Oct 2019 14:35:44 +0000 (20:05 +0530)
committerEvan You <yyx990803@gmail.com>
Fri, 25 Oct 2019 14:35:44 +0000 (10:35 -0400)
packages/compiler-dom/src/parserOptionsMinimal.ts

index 38b3e6a8343f48fbc58e41be307e9d2bcd24e1d7..09cbcb0d7d8bf64bf5686accaf6e436acaf86eaf 100644 (file)
@@ -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
       }
     }