Skip to content

fix(svg): note that moveto accepts more than one coordinate pair - #45391

Open
rajanpanth wants to merge 1 commit into
mdn:mainfrom
rajanpanth:fix/svg-paths-moveto-extra-pairs
Open

fix(svg): note that moveto accepts more than one coordinate pair#45391
rajanpanth wants to merge 1 commit into
mdn:mainfrom
rajanpanth:fix/svg-paths-moveto-extra-pairs

Conversation

@rajanpanth

Copy link
Copy Markdown
Contributor

Description

Corrects the SVG paths tutorial's claim that the "Move To" command takes two parameters, and adds a short paragraph explaining what additional coordinate pairs do.

Motivation

Fixes #45289.

The "Line commands" section said M "takes two parameters, a coordinate (x) and coordinate (y) to move to". Per the SVG path grammar, M and m take a coordinate pair sequence: only the first pair moves the current point, and every pair after it is drawn as an implicit lineto. So M 10 10 90 10 90 90 draws a polyline rather than performing three moves, and a path can trace a whole polygon without an explicit L at all. Since the page presents the two-parameter form as the definition, a reader has no way to predict what a path like that does.

Changed the count to "at least two parameters" and added one paragraph after the syntax block giving the equivalence, M 10 10 90 10 90 90 is the same as M 10 10 L 90 10 L 90 90, plus a note that pairs after a relative m are relative lines.

Additional details

The issue also raises several points about Z/z, implicit closing lines, and stroke rendering differences between an explicit final lineto and a close. Those are correct but they are a separate, larger topic, and this page is an introductory tutorial that covers Z further down in its own section. I have kept this change to the factual error about moveto parameters so it stays reviewable. Happy to open a follow-up for the Z behavior if you would like it documented here.

Related issues and pull requests

Fixes #45289

The SVG paths tutorial said the Move To command takes two parameters.
Per the SVG path grammar, M and m accept a coordinate pair sequence:
only the first pair moves the cursor, and each pair after it is drawn
as an implicit lineto. So M 10 10 90 10 90 90 draws a polyline rather
than performing three moves.

Changed the count to at least two and added a short paragraph with an
equivalence example. Kept it brief since this is an introductory
tutorial.
@rajanpanth
rajanpanth requested a review from a team as a code owner August 30, 2026 02:12
@rajanpanth
rajanpanth requested review from hamishwillee and removed request for a team August 30, 2026 02:12
@github-actions github-actions Bot added Content:SVG SVG docs size/xs [PR only] 0-5 LoC changed labels Aug 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview URLs (1 page)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:SVG SVG docs size/xs [PR only] 0-5 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"moveto" commands in paths can have more than 2 parameters

2 participants