v160 · dom · svg

Segment inspector

Give the browser a d string and let it hand back structure. The left table is getPathData() — every command exactly as authored, relative letters and shorthand included. The right table is getPathData({normalize: true}) — the same geometry as nothing but absolute M, L, C and Z, which is the form most tools actually want to consume.

Chrome 160+ ships this by default. Earlier Chrome/Canary: enable chrome://flags/#enable-experimental-web-platform-features, or launch with --enable-blink-features=SVGPathDataAPI (also --enable-features=SVGPathDataAPI or --enable-experimental-web-platform-features).
Probing this browser…

Path under inspection

The inspected path, with the selected segment highlighted in rose
Apply a path to read it back.
getPathData() — as authored
#typevalues
getPathData({normalize: true}) — M / L / C / Z
#typevalues

the calls, verbatim

subject.setAttribute("d", textarea.value);

const raw  = subject.getPathData();                     // as authored
const norm = subject.getPathData({ normalize: true });  // absolute M/L/C/Z only

// highlight segment i without any path maths of our own:
probe.setPathData(raw.slice(0, i));     const from = probe.getTotalLength();
probe.setPathData(raw.slice(0, i + 1)); const to   = probe.getTotalLength();
// …then sample subject.getPointAtLength(from … to)

Things to notice: h/v become L; q, t and S become C with their implied control points made explicit; one arc becomes one or more cubic Béziers (an approximation — the explainer calls arc-to-cubic “inherently lossy”); and normalised values come back as floats, so expect digits like 66.66667175292969.

see also