demo · v143

SVG / MathML round-trip

SVG and MathML use mixed-case element names (linearGradient, mtable, foreignObject) and colon-namespaced attributes (xlink:href). The parser accepts them all. Before Chrome 143, scripts trying to rebuild the same trees with createElement + setAttribute often hit InvalidCharacterError. Now they don't — pick a snippet, see it parse, then reconstruct piece by piece using the DOM APIs.

source markup

reconstructed via JS DOM APIs

Pick a sample to compare.

Rendered output

parser-built
JS-rebuilt

What this proves

  1. The parser tolerates SVG / MathML's special casing and colon-namespaced attributes.
  2. The JS DOM equivalents now match. document.createElementNS(SVG_NS, "linearGradient") survives. el.setAttribute("xlink:href", "#x") works.
  3. If a path here fails in your browser, you're on a build that hasn't shipped the relaxation yet.
// JS path that works in v143
const lg = document.createElementNS(SVG_NS, "linearGradient");
const stop = document.createElementNS(SVG_NS, "stop");
stop.setAttribute("offset", "0%");
stop.setAttribute("stop-color", "var(--accent-blue)");

see also