pull/11387/head
Rich Harris 2 years ago
parent 6f06bd9300
commit 4fe8ea4671

@ -1379,11 +1379,9 @@ const common_visitors = {
FunctionExpression: function_visitor, FunctionExpression: function_visitor,
FunctionDeclaration: function_visitor, FunctionDeclaration: function_visitor,
RegularElement(node, context) { RegularElement(node, context) {
if (context.state.options.namespace !== 'foreign' && SVGElements.includes(node.name)) { if (context.state.options.namespace !== 'foreign') {
node.metadata.svg = true; if (SVGElements.includes(node.name)) node.metadata.svg = true;
} else if (MathMLElements.includes(node.name)) node.metadata.mathml = true;
if (context.state.options.namespace !== 'foreign' && MathMLElements.includes(node.name)) {
node.metadata.mathml = true;
} }
determine_element_spread(node); determine_element_spread(node);
@ -1444,22 +1442,18 @@ const common_visitors = {
if ( if (
context.state.options.namespace !== 'foreign' && context.state.options.namespace !== 'foreign' &&
node.tag.type === 'Literal' && node.tag.type === 'Literal' &&
typeof node.tag.value === 'string' && typeof node.tag.value === 'string'
SVGElements.includes(node.tag.value)
) { ) {
if (SVGElements.includes(node.tag.value)) {
node.metadata.svg = true; node.metadata.svg = true;
return; return;
} }
if ( if (MathMLElements.includes(node.tag.value)) {
context.state.options.namespace !== 'foreign' &&
node.tag.type === 'Literal' &&
typeof node.tag.value === 'string' &&
MathMLElements.includes(node.tag.value)
) {
node.metadata.mathml = true; node.metadata.mathml = true;
return; return;
} }
}
for (const attribute of node.attributes) { for (const attribute of node.attributes) {
if (attribute.type === 'Attribute') { if (attribute.type === 'Attribute') {

Loading…
Cancel
Save