From 36800b43b20ad6c47660c1915fa140982f2a0ab1 Mon Sep 17 00:00:00 2001
From: Baptiste Parmantier
Date: Tue, 22 Sep 2026 11:06:01 +0200
Subject: [PATCH] fix(html): reject unsupported children of text tags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The `TagKind::Text` arm never calls `element_to_value` on its children, so the whole guard layer (`StyleElementUnsupported`, `UnsupportedNativeElement`, `TagKind::Ignored`) is unreachable below `p/span/h1..h6/strong/em/label`. Executed against the real crate: `
Real
` transpiles to `{"content":"Real var secret = 1; alert(2);","type":"text"}` — the JS source is rendered on screen; `
Title
` gives `{"content":"Titleh1{color:#0f0}"}`; `
cap
`, `
t
` and `n=` drop the img/svg/counter entirely and exit 0. This is a live regression of "constat 1" and "constat 3", which tests/silent_loss_regressions.rs asserts are fixed — the fix only ever covered the `Container` path.
Refs #220
---
crates/rustmotion-html/src/element.rs | 42 ++++++++++--
crates/rustmotion-html/tests/audit_ws_f.rs | 76 ++++++++++++++++++++++
2 files changed, 111 insertions(+), 7 deletions(-)
diff --git a/crates/rustmotion-html/src/element.rs b/crates/rustmotion-html/src/element.rs
index 337c8b2e..0722aa9d 100644
--- a/crates/rustmotion-html/src/element.rs
+++ b/crates/rustmotion-html/src/element.rs
@@ -37,20 +37,48 @@ fn tag_kind(tag: &str) -> TagKind {
}
}
-/// Concatenated text of an element and all its descendants.
-pub(crate) fn inner_text(handle: &Handle) -> String {
+/// Concatenated text of an element and all its descendants. Nested inline
+/// formatting tags (`strong`/`em`/`label`/…) flatten in, matching real HTML;
+/// `
"##;
+ let v = html_to_scenario_value(html).expect("