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
} 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
}
}