[svgwg] Relax SVG Path grammar with an optional first MoveTo command (#780)

JeremiePat has just created a new issue for https://github.com/w3c/svgwg:

== Relax SVG Path grammar with an optional first MoveTo command ==
Hello SVGWG

According to the [the current SVG2 Path grammar](https://svgwg.org/svg2-draft/paths.html#PathDataBNF) the first command in a path **must be** a moveTo command.

I would advocate for relaxing that constrain and consider that **all path should start with an implicit `M0,0` command**.

That simple change would have two benefits:

1. This would make the parsing of SVG path way easier without introducing any breaking change (except the fact that authors providing current wrong path would get a path drawn instead of no rendering).

2. This would make some prose a lot less convoluted. For example, in the [definition of the MoveTo command](https://svgwg.org/svg2-draft/paths.html#PathDataMovetoCommands), it is stated that: 

> If a relative moveto (m) appears as the first element of the path, then it is treated as a pair of absolute coordinates. In this case, subsequent pairs of coordinates are treated as relative even though the initial moveto is interpreted as an absolute moveto.
  
Which means that a path like `m1,1 2,2` must be interpreted as `M1,1 l2,2`. With an implicit `M0,0` command at the beginning, that whole text can be removed and the management of path data will be a lot easier for implementer.


Please view or discuss this issue at https://github.com/w3c/svgwg/issues/780 using your GitHub account

Received on Wednesday, 11 March 2020 10:53:32 UTC