perf(compiler-dom): use makeMap instead of RegEx (#354)
This commit is contained in:
parent
532b5eebd7
commit
a489f98a66
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user