]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: regex caching makes no difference
authorEvan You <yyx990803@gmail.com>
Tue, 17 Sep 2019 16:26:09 +0000 (12:26 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 17 Sep 2019 16:26:09 +0000 (12:26 -0400)
packages/compiler-dom/src/parserOptionsMinimal.ts

index a22614a8ae9b26cb16d77ab6325b0e490b83e0f6..f74120d4bbd7c07947c44edc796d6c31c8452eeb 100644 (file)
@@ -12,10 +12,6 @@ export const enum DOMNamespaces {
   MATH_ML
 }
 
-const MATH_ML_TEXT_INTEGRATION_POINT_RE = /^m(?:[ions]|text)$/
-const RAW_TEXT_CONTAINER_RE = /^(?:style|xmp|iframe|noembed|noframes|script|noscript)$/i
-const VOID_TAG_RE = /^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i
-
 export const parserOptionsMinimal: ParserOptions = {
   // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
   getNamespace(tag: string, parent: ElementNode | undefined): DOMNamespaces {
@@ -39,7 +35,7 @@ export const parserOptionsMinimal: ParserOptions = {
           ns = DOMNamespaces.HTML
         }
       } else if (
-        MATH_ML_TEXT_INTEGRATION_POINT_RE.test(parent.tag) &&
+        /^m(?:[ions]|text)$/.test(parent.tag) &&
         tag !== 'mglyph' &&
         tag !== 'malignmark'
       ) {
@@ -72,7 +68,9 @@ export const parserOptionsMinimal: ParserOptions = {
       if (tag === 'textarea' || tag === 'title') {
         return TextModes.RCDATA
       }
-      if (RAW_TEXT_CONTAINER_RE.test(tag)) {
+      if (
+        /^(?:style|xmp|iframe|noembed|noframes|script|noscript)$/i.test(tag)
+      ) {
         return TextModes.RAWTEXT
       }
     }
@@ -80,6 +78,8 @@ export const parserOptionsMinimal: ParserOptions = {
   },
 
   isVoidTag(tag: string): boolean {
-    return VOID_TAG_RE.test(tag)
+    return /^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i.test(
+      tag
+    )
   }
 }