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.
Path under inspection
Apply a path to read it back.
| # | type | values |
|---|
| # | type | values |
|---|
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.