fix: improve namespace handling for SVG and MathML tags
ci / test (push) Has been cancelled Details
ci / continuous-release (push) Has been cancelled Details

This commit is contained in:
daiwei 2025-07-29 09:45:45 +08:00
parent 1b28566d5e
commit fb4207c999
1 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ export const parserOptions: ParserOptions = {
let ns = parent ? parent.ns : rootNamespace let ns = parent ? parent.ns : rootNamespace
if (parent && ns === Namespaces.MATH_ML) { if (parent && ns === Namespaces.MATH_ML) {
if (parent.tag === 'annotation-xml') { if (parent.tag === 'annotation-xml') {
if (tag === 'svg') { if (isSVGTag(tag)) {
return Namespaces.SVG return Namespaces.SVG
} }
if ( if (
@ -57,10 +57,10 @@ export const parserOptions: ParserOptions = {
} }
if (ns === Namespaces.HTML) { if (ns === Namespaces.HTML) {
if (tag === 'svg') { if (isSVGTag(tag)) {
return Namespaces.SVG return Namespaces.SVG
} }
if (tag === 'math') { if (isMathMLTag(tag)) {
return Namespaces.MATH_ML return Namespaces.MATH_ML
} }
} }