In https://developer.mozilla.org/en-US/docs/Web/API/SVGGeometryElement, the note says this:

Note: In SVG 2 the getPathSegAtLength() and createSVGPathSeg* methods were removed and the pathLength property and the getTotalLength() and getPointAtLength() methods were moved to SVGGeometryElement.

What are the practical implications of this? So far I'm doing, for instance:

document.getElementById("myPath") --> myPath.isPointInStroke()

and works fine.

1

There are 1 answers

1
Robert Longson On BEST ANSWER

The path, rect, circle, ellipse, polygon, polyline and line elements all derive from SVGGraphicsElement in SVG 2. Moving methods from SVGPathElement to SVGGraphicsElement makes them available to all subclasses.

So in SVG 2 you can call getTotalLength() on a circle, which will cause the browser to return 2πr, whereas in SVG 1.1 you could only get the total length of a path element.