perf(compiler-dom): use makeMap instead of RegEx (#354)

This commit is contained in:
Ayush Goyal 2019-10-25 20:05:44 +05:30 committed by Evan You
parent 532b5eebd7
commit a489f98a66

View File

@ -6,6 +6,12 @@ import {
NodeTypes NodeTypes
} from '@vue/compiler-core' } from '@vue/compiler-core'
import { isVoidTag, isHTMLTag, isSVGTag } from './tagConfig' import { isVoidTag, isHTMLTag, isSVGTag } from './tagConfig'
import { makeMap } from '@vue/shared'
const isRawTextContainer = /*#__PURE__*/ makeMap(
'style,iframe,script,noscript',
true
)
export const enum DOMNamespaces { export const enum DOMNamespaces {
HTML = Namespaces.HTML, HTML = Namespaces.HTML,
@ -73,9 +79,7 @@ export const parserOptionsMinimal: ParserOptions = {
if (tag === 'textarea' || tag === 'title') { if (tag === 'textarea' || tag === 'title') {
return TextModes.RCDATA return TextModes.RCDATA
} }
if ( if (isRawTextContainer(tag)) {
/^(?:style|xmp|iframe|noembed|noframes|script|noscript)$/i.test(tag)
) {
return TextModes.RAWTEXT return TextModes.RAWTEXT
} }
} }