Summary
The convenience constructors @html.svg and @html.math both delegate to the generic HTML node constructor. That produces VNodes with no namespace, so the runtime calls document.createElement instead of document.createElementNS.
As a result, these constructors do not create real SVG or MathML elements in an HTML document.
Evidence
A white-box test inspecting the VNode created by @html.svg observed:
expected: Some(http://www.w3.org/2000/svg)
actual: None
The same source path gives @html.math a None namespace.
Expected behavior
@html.svg should use http://www.w3.org/2000/svg.
@html.math should use http://www.w3.org/1998/Math/MathML.
The resulting browser elements should have the correct namespaceURI and native element type.
Additional MathML blocker
After adding the MathML namespace, style handling also needs attention. The runtime style branch accepts only HTMLElement or SVGElement and otherwise panics:
A namespaced MathML element is neither, so fixing only the namespace can expose a second failure even when the style list is empty.
Suggested tests
- Assert both constructors retain the expected namespace in the VNode.
- In a browser test, assert each element's
namespaceURI.
- Verify SVG rendering and MathML creation/update, including the empty-style path.
Summary
The convenience constructors
@html.svgand@html.mathboth delegate to the generic HTMLnodeconstructor. That produces VNodes with no namespace, so the runtime callsdocument.createElementinstead ofdocument.createElementNS.As a result, these constructors do not create real SVG or MathML elements in an HTML document.
Evidence
nodecreates a VNode without a namespace@html.svgand@html.mathboth callnodecreate_elementwhen namespace is absentA white-box test inspecting the VNode created by
@html.svgobserved:The same source path gives
@html.mathaNonenamespace.Expected behavior
@html.svgshould usehttp://www.w3.org/2000/svg.@html.mathshould usehttp://www.w3.org/1998/Math/MathML.The resulting browser elements should have the correct
namespaceURIand native element type.Additional MathML blocker
After adding the MathML namespace, style handling also needs attention. The runtime style branch accepts only
HTMLElementorSVGElementand otherwise panics:A namespaced MathML element is neither, so fixing only the namespace can expose a second failure even when the style list is empty.
Suggested tests
namespaceURI.