Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm committed Dec 18, 2024
1 parent 208ff6d commit ef8c56e
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,23 @@ export function RegularElement(node, context) {
(attribute) => attribute.type === 'SpreadAttribute'
);

node.metadata.svg =
is_svg(node.name) ||
(node.name === 'a' &&
context.path.some((n) => n.type === 'RegularElement' && n.name === 'svg'));
const is_svg_element = () => {
if (is_svg(node.name)) {
return true;
}
if (node.name === 'a') {
for (let i = context.path.length - 1; i >= 0; i--) {
const ancestor = context.path[i];
if (ancestor.type === 'RegularElement') {
return ancestor.metadata.svg;
}
}
}

return false;
};

node.metadata.svg = is_svg_element();
node.metadata.mathml = is_mathml(node.name);

if (is_custom_element_node(node) && node.attributes.length > 0) {
Expand Down

0 comments on commit ef8c56e

Please sign in to comment.