[svgwg] `SVGPathSegment` should be a dictionary, not a `[NoInterfaceObject]` interface (#1082)

viralipurbey has just created a new issue for https://github.com/w3c/svgwg:

== `SVGPathSegment` should be a dictionary, not a `[NoInterfaceObject]` interface ==
The SVG Paths spec ([§7.1](https://svgwg.org/specs/paths/#InterfaceSVGPathSegment)) currently defines `SVGPathSegment` as a `[NoInterfaceObject]` interface. This is problematic for three reasons:

1. `[NoInterfaceObject]` is deprecated in WebIDL. Modern WebIDL does not support this annotation; using it in a new spec is non-conforming.
2. Interface types prevent POJO compatibility. If `SVGPathSegment` is an interface, `setPathData()` requires actual `SVGPathSegment` wrapper objects rather than plain `{type, values}` JavaScript objects. This breaks the widely-used [path-data-polyfill](https://github.com/jarek-foksa/path-data-polyfill) (129+ stars), which creates plain objects. Firefox updated their code when it initially rejected POJOs and had to ship a separate fix in Firefox 138 ([bugzilla#1954044](https://bugzilla.mozilla.org/show_bug.cgi?id=1954044)).

Proposed change - replace the current WebIDL:

```
// Current:
[NoInterfaceObject]
interface SVGPathSegment {
  DOMString type;
  sequence<float> values;
};
```

with:

```
dictionary SVGPathSegment {
  required DOMString type;
  required sequence<unrestricted float> values;
};
```

This change bundles three improvements:

- `interface` → `dictionary`: Natively accepts POJOs, matching polyfill behavior and Firefox 138+.
- `float` → `unrestricted float`: SVG's error model is "render what you can." Path data can legally contain degenerate values (e.g., `A 0 0 0 0 0 0 0`). Using float would throw `TypeError` on NaN/Infinity, contradicting SVG's graceful-degradation model. `unrestricted float` matches Firefox's actual behavior and the polyfill.
- `required` keywords: Without required, `setPathData([{}])` would silently pass validation with undefined type and values. Both members must be present for a valid path segment.

All three changes are already aligned with Firefox's shipped behavior and the polyfill ecosystem. Chromium plans to implement with these semantics as well.

We already have one issue in editing WG: https://github.com/w3c/editing/issues/483

Please view or discuss this issue at https://github.com/w3c/svgwg/issues/1082 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 26 March 2026 06:19:05 UTC