webapi: assigning outerText to a MathML element leaves the tree alone

Fixes the last failing subtest of WPT /html/dom/elements/
the-innertext-and-outertext-properties/outertext-setter.html
(42/43 -> 43/43): outerText is an HTMLElement property, so assigning it
on a MathML <math> element must not replace the element.

MathML elements currently share the HTML wrapper types (giving them a
plain Element wrapper is part of the pending element-interface work),
so they expose the outerText setter; it now stays inert for non-HTML
namespaces.

Coverage: outertext-setter.html 42/43 -> 43/43 (fully green).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Francis Bouvier
2026-07-12 12:10:00 +02:00
committed by Karl Seguin
parent ab357b354e
commit 7bbfc1a871

View File

@@ -243,6 +243,11 @@ pub fn setInnerText(self: *HtmlElement, text: []const u8, frame: *Frame) !void {
pub fn setOuterText(self: *HtmlElement, text: []const u8, frame: *Frame) !void {
const el = self.asElement();
// outerText is an HTMLElement property. MathML elements currently share
// the HTML wrapper types, so keep the assignment inert for them.
if (el._namespace != .html) {
return;
}
const node = el.asNode();
const parent = node.parentNode() orelse return error.NoModificationAllowed;