Skip to content

Commit 6b9f3b7

Browse files
committed
fix(compiler-core): math tag should use block
1 parent c0c9432 commit 6b9f3b7

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/compiler-core/__tests__/transforms/transformElement.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,18 @@ describe('compiler: element transform', () => {
12841284
})
12851285
})
12861286

1287+
test('<math> should be forced into blocks', () => {
1288+
const ast = parse(`<div><math/></div>`)
1289+
transform(ast, {
1290+
nodeTransforms: [transformElement],
1291+
})
1292+
expect((ast as any).children[0].children[0].codegenNode).toMatchObject({
1293+
type: NodeTypes.VNODE_CALL,
1294+
tag: `"math"`,
1295+
isBlock: true,
1296+
})
1297+
})
1298+
12871299
test('force block for runtime custom directive w/ children', () => {
12881300
const { node } = parseWithElementTransform(`<div v-foo>hello</div>`)
12891301
expect(node.isBlock).toBe(true)

packages/compiler-core/src/transforms/transformElement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const transformElement: NodeTransform = (node, context) => {
117117
// updates inside get proper isSVG flag at runtime. (#639, #643)
118118
// This is technically web-specific, but splitting the logic out of core
119119
// leads to too much unnecessary complexity.
120-
(tag === 'svg' || tag === 'foreignObject'))
120+
(tag === 'svg' || tag === 'foreignObject' || tag === 'math'))
121121

122122
// props
123123
if (props.length > 0) {

0 commit comments

Comments
 (0)