fix(compiler-dom): should ignore and warn side effect tags like script and style
This keeps behavior consistency with v2.
This commit is contained in:
15
packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
Normal file
15
packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { NodeTransform, NodeTypes, ElementTypes } from '@vue/compiler-core/src'
|
||||
import { DOMErrorCodes, createDOMCompilerError } from '../errors'
|
||||
|
||||
export const ignoreSideEffectTags: NodeTransform = (node, context) => {
|
||||
if (
|
||||
node.type === NodeTypes.ELEMENT &&
|
||||
node.tagType === ElementTypes.ELEMENT &&
|
||||
(node.tag === 'script' || node.tag === 'style')
|
||||
) {
|
||||
context.onError(
|
||||
createDOMCompilerError(DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG, node.loc)
|
||||
)
|
||||
context.removeNode()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user