Skip to content

Commit ef61a33

Browse files
committed
fix(runtime-dom): fix the bug that the element of mathml cannot be created normally.
1 parent 6a370ec commit ef61a33

File tree

1 file changed

+2
-35
lines changed

1 file changed

+2
-35
lines changed

packages/runtime-dom/src/nodeOps.ts

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { RendererOptions } from '@vue/runtime-core'
2+
import { isMathMLTag } from '@vue/shared'
23

34
export const svgNS = 'http://www.w3.org/2000/svg'
45
export const mathmlNS = 'http://www.w3.org/1998/Math/MathML'
@@ -20,44 +21,10 @@ export const nodeOps: Omit<RendererOptions<Node, Element>, 'patchProp'> = {
2021
},
2122

2223
createElement: (tag, namespace, is, props): Element => {
23-
// https://www.javatpoint.com/mathml-all-elements
24-
const allMathmlTags = [
25-
'maction',
26-
'math',
27-
'menclose',
28-
'merror',
29-
'mfenced',
30-
'mfrac',
31-
'mglyph',
32-
'mi',
33-
'mlabeledtr',
34-
'mmultiscripts',
35-
'mn',
36-
'mo',
37-
'mover',
38-
'mpadded',
39-
'mphantom',
40-
'mroot',
41-
'mrow',
42-
'ms',
43-
'mspace',
44-
'msqrt',
45-
'mstyle',
46-
'msub',
47-
'msubsup',
48-
'msup',
49-
'mtable',
50-
'mtd',
51-
'mtext',
52-
'mtr',
53-
'munder',
54-
'munderover',
55-
'semantics',
56-
]
5724
const el =
5825
namespace === 'svg'
5926
? doc.createElementNS(svgNS, tag)
60-
: namespace === 'mathml' || allMathmlTags.includes(tag)
27+
: namespace === 'mathml' || isMathMLTag(tag)
6128
? doc.createElementNS(mathmlNS, tag)
6229
: doc.createElement(tag, is ? { is } : undefined)
6330

0 commit comments

Comments
 (0)