[w3c/editing] Clarification on [NoInterfaceObject] for SVGPathSegment and Usage of setPathData() (Issue #483)

lovasoa created an issue (w3c/editing#483)

Hi ! I'm a simple web developer, maintainer of the wbo.ophir.dev open source whiteboard, which was recently struck by https://github.com/lovasoa/whitebophir/issues/321

I'm seeking clarification on the design decision to mark `SVGPathSegment` with `[NoInterfaceObject]` in the SVG specification: https://svgwg.org/specs/paths/#InterfaceSVGPathSegment

 This attribute prevents direct instantiation of `SVGPathSegment` objects in JavaScript, which complicates the use of methods like `setPathData()` that expect a sequence of `SVGPathSegment` objects.

Given that `SVGPathSegment` isn't directly constructible, how are developers intended to create and pass path segment objects to `setPathData()`? Is the expectation to use plain JavaScript objects that match the structure of `SVGPathSegment` ? Then shouldn't we have:

```webidl
dictionary SVGPathSegmentInit {
  required DOMString type;
  required sequence<float> values;
};

interface mixin SVGPathData {
  sequence<SVGPathSegment> getPathData(optional SVGPathDataSettings settings = {});
  undefined setPathData(sequence<SVGPathSegmentInit> pathData);
};
```

Thank you for your insights !

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/483
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/editing/issues/483@github.com>

Received on Friday, 4 April 2025 22:05:43 UTC