Skip to content

@html.svg and @html.math create elements without SVG/MathML namespaces #134

Description

@yorkin-bot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions