← Chrome 160 reference · All APIs
v160 · svg · covered on mdn
SVG Path Data API
Adds structured JavaScript access to SVG <path> geometry via three methods on SVGPathElement (SVGPathData mixin): getPathData() reads the base d attribute as an array of { type, values } segment objects (with optional { normalize: true } reducing commands to absolute M, L, C, and Z), setPathData() writes a segment array back to d, and getPathSegmentAtLength() returns the segment at a given distance along the path.
this feature is documented on MDN
- MDN:
SVGPathElement.setPathData()method — syntax,{ type, values }segment parameters, worked example, Specifications, and Browser compatibility - MDN:
SVGPathElement.getPathSegmentAtLength()method — syntax,distanceparameter,nullempty-path return, worked example, Specifications, and Browser compatibility
MDN publishes complete, dedicated reference pages for all three SVGPathData methods (verified HTTP 200 on 2026-11-24, each with Syntax, Parameters, Return value, Examples, Specifications, and Browser compatibility). gendn does not duplicate MDN’s reference prose here.
Why gendn doesn’t duplicate MDN: this site exists for Chrome features without a canonical MDN page yet. When MDN already documents an API completely, gendn publishes an honest pointer alongside the Chrome 160 implementation nuances and live showcase embed MDN does not track.
what Chrome 160 actually does
In Blink’s svg_path_element.cc and svg_path_data.idl (verified against the svg/path/interfaces WPT suite):
- Base
dattribute only: All three methods read or mutate the element’s basedcontent attribute — CSSd: path(...)declarations, SMIL<animate attributeName="d">, and Web Animations do not altergetPathData()orgetPathSegmentAtLength(). - Valid-prefix truncation in
setPathData(): Encountering an unknown command letter, wrongvalues.length(unlike thedstring parser, extra parameters are not split into implicit repeats), non-finite numbers (NaN,Infinity), or non-emptyvaluesonZ/zstops parsing at that segment and retains only the valid preceding segments. - Attribute mutation & empty removal: Passing an empty array (or a list invalid at index 0) calls
removeAttribute("d"); otherwise Blink serializes the valid-prefix byte stream throughsetAttribute("d", ...)soMutationObserver,<use>instances, and<mpath>dependencies update normally. - Distance clamping in
getPathSegmentAtLength(distance): Returnsnullwhen the base path is empty; otherwise clampsdistanceto[0, getTotalLength()]so negative values return the first segment and values beyond total length return the last segment.
if ("getPathData" in SVGPathElement.prototype) {
const path = document.querySelector("svg path");
const normalized = path.getPathData({ normalize: true }); // M, L, C, Z only
const atMidpoint = path.getPathSegmentAtLength(path.getTotalLength() / 2);
// Translate every absolute M/L/C coordinate by +10px on X
const shifted = normalized.map(({ type, values }) => ({
type,
values: values.map((v, i) => (i % 2 === 0 ? v + 10 : v)),
}));
path.setPathData(shifted);
console.log({ segmentCount: shifted.length, atMidpoint });
}
Source: Blink svg_path_element.cc; WPT setPathData-malformed.html; WPT getPathSegmentAtLength-clamping.html.
live example
Browser compatibility
| Browser | getPathData() / setPathData() / getPathSegmentAtLength() | Evidence / notes |
|---|---|---|
| Chrome (desktop, Android, WebView) | 160 (BCD lags as false) | Enabled by default in Chrome 160 per ChromeStatus API record (SVGPathDataAPI Blink runtime feature) |
| Edge | 160 (mirror) | Chromium-based; Microsoft authored the Blink implementation, MSEdge explainer, and Interop 2027 proposal (#1469) |
| Firefox | 137 | Shipped April 2025 (Mozilla Bug 1934525; confirmed in BCD) |
| Safari | No release | WebKit standards-positions#731 (No signal yet; false in BCD) |
api/SVGPathElement.json; ChromeStatus API record (4787972240179200); Bugzilla 1934525.
quick reference
| IDL | SVGPathDataSettings { boolean normalize = false; } · SVGPathSegment { required DOMString type; required sequence<unrestricted float> values; } · SVGPathData mixin (getPathData(), setPathData(), getPathSegmentAtLength()) included on SVGPathElement (Blink svg_path_data.idl) |
|---|---|
| Shipped in | Chrome 160 (desktop, Android, Android WebView), enabled by default — filed under “Enabled by default” in the milestone=160 listing (feature type: “Chromium catches up”) |
| Runtime flag | Blink runtime feature SVGPathDataAPI in runtime_enabled_features.json5 |
| Intent & bug | blink-dev Intent to Ship · Intent to Prototype · issues.chromium.org/40441025 |
| TAG review | w3ctag/design-reviews#1292 (Pending) |
| Web platform tests | wpt.fyi — svg/path/interfaces |
| ChromeStatus | 4787972240179200 — SVG Path Data API |
references
- MDN —
SVGPathElement.getPathData()(canonical reference) ·setPathData()·getPathSegmentAtLength() - W3C SVG Paths Editor’s Draft —
SVGPathDatainterface mixin - Microsoft Edge explainer — SVG Path Data API
- Chrome Platform Showcase — SVG Path Data API demos
path-data-polyfill(community polyfill for non-supporting engines)- ChromeStatus — SVG Path Data API (4787972240179200) (API record)