Skip to content

Clarification on [NoInterfaceObject] for SVGPathSegment and Usage of setPathData() #483

@lovasoa

Description

@lovasoa

Hi ! I'm a simple web developer, maintainer of the wbo.ophir.dev open source whiteboard, which was recently struck by lovasoa/whitebophir#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:

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 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions