Add SVG Path Data API explainer#1290
Open
viralipurbey wants to merge 3 commits intoMicrosoftEdge:mainfrom
Open
Add SVG Path Data API explainer#1290viralipurbey wants to merge 3 commits intoMicrosoftEdge:mainfrom
viralipurbey wants to merge 3 commits intoMicrosoftEdge:mainfrom
Conversation
Proposes adding getPathData(), setPathData(), and getPathSegmentAtLength() to SVGPathElement, implementing the SVG Paths spec DOM interfaces. Already shipped in Firefox 137+.
Author
|
@microsoft-github-policy-service agree company="Microsoft" |
- Fix security claim: setPathData() operates on structured data, no string parsing needed (does not go through setAttribute) - Add arc-to-cubic normalization precision note - Document empty path behavior: getPathData() returns [], setPathData([]) clears the path - Document getPathSegmentAtLength edge cases: null for empty/NaN, clamp negative to 0 - Split before/after example into separate code blocks to avoid variable redeclaration - Fix Chrome 48 date from 2015 to Jan 2016 (stable release date) - Fix spec PR status wording: 'to be filed' instead of 'pending'
6af2a15 to
588800b
Compare
Contributor
|
Looks good to me |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an explainer for implementing the SVG Path Data API (
getPathData(),setPathData(),getPathSegmentAtLength()) onSVGPathElement.Tracking issue: #1289
Background
Chrome removed the old
SVGPathSegListAPI in Chrome 48 (2015). The SVG WG specified a cleaner replacement in the SVG Paths spec §7, which Firefox shipped in v137 (Jan 2025). Chrome has had no native segment-level path access for 10+ years (crbug.com/40441025, 45 upvotes).Proposed API
getPathData(settings){type, values}plain objectssetPathData(pathData){type, values}objectsgetPathSegmentAtLength(distance)Supports
{normalize: true}to reduce all commands to absolute M, L, C, Z.Key design decisions
{type, values}POJOs natively, avoiding the compatibility issue Firefox hit in v137unrestricted float- NaN/Infinity accepted without throwing, matching SVG's error modelChanges
SVG/SVGPathDataAPI/explainer.md- full explainerREADME.md- added entry to Active Explainers table (SVG group)