From 96e1fd0fb8653d9c1be6f04f7d1f01bd5f55aedf Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Thu, 19 Sep 2024 17:20:30 -0400 Subject: [PATCH] fix: turn off InertHtml for SVG/MathML (closes #2998) (#2999) --- leptos_macro/src/view/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/leptos_macro/src/view/mod.rs b/leptos_macro/src/view/mod.rs index 657a31e95..8dc694e60 100644 --- a/leptos_macro/src/view/mod.rs +++ b/leptos_macro/src/view/mod.rs @@ -103,6 +103,12 @@ fn is_inert_element(orig_node: &Node) -> bool { if el.attributes().is_empty() && el.children.is_empty() { return false; } + + // also doesn't work if the top-level element is an SVG/MathML element + let el_name = el.name().to_string(); + if is_svg_element(&el_name) || is_math_ml_element(&el_name) { + return false; + } } _ => return false, }