Re: [svgwg] SVG2 path data coordinates are currently spec'd as integers.

@tshinnic Yeah, it took a while to see the 'O'.

Actually, railroad diagrams aren't normative for CSS. (See [CSS Syntax S4.1](https://drafts.csswg.org/css-syntax-3/#token-diagrams)) It's the step-by-step algorithms that are. I'd be happy to follow either path. (Railroad diagrams are isomorphic to an EBNF which has had character ranges and the `+` quantifier removed. And SVG 1.1 already has additional algorithmic constraints to handle the "0.0.0" case, and will need more for 2.0 ) But, for the moment, as always, we're trying to fix what's in the extant spec so we stick with what's there. \*sigh\*

@fsoder, Yeah, my production code is equally undertested. Same reasons. More so, because I've been spending time on this. ;)

I need to create a separate issue for this, but while you're here, how does Firefox handle large numbers? Chrome appears to use single precision with weirdness.  It will draw `"M0 0 1E37 0 0 300 Z"` ([fiddle](https://jsfiddle.net/ygwtsf5t/)), it doesn't draw or issue an error for `"M0 0 1E38 0 0 300 Z"` ([fiddle](https://jsfiddle.net/z9yoohe3/)) and it throws on `"M0 0 1E39 0 0 300 Z"` ([fiddle](https://jsfiddle.net/ronmahxp/1/)) with the unhelpful error `Expected number, "M0 0 1E39 0 0 300 Z"`. It will draw up to the error, as per error handling rules.

But I've just looked at those in Firefox and I don't see errors or drawing. It would be nice to get this standardised.

**All** One idea I had to simplify testing was to propose a read only property that returned the _rendered_ path, possibly in a normal form.  Then you could do `path.setAttribute("d","M0,0,L0,0"`) and check for an exception and that the rendered path was `"M 0 0"`. Blessing a normal form would start the decades long path to doing away with crazy syntax. It would also give webdevs something easy to parse.

Correction
-----------
Previously, the 1.1 grammar had:
```
comma-wsp ::= (wsp+ (comma wsp*)) | (comma? wsp*)
comma ::= ","
```
So comma-wsp was entirely optional, even though it's supposed to be mandatory. It's now:
```
comma-wsp    ::= wsp+ delimiter? | delimiter
delimiter    ::= "," wsp*
```
I can't actually see a way to exploit this, because, if it was omitted in the one place's its mandatory (before the first `flag` on the elliptical arc), your `flag` would be consumed as part of the preceding number. That's how crazy this grammar is. 

I've also removed some excess brackets (having finally found the precedence rules for EBNF  😳).  I have the 2.0 grammar working, but that will have to wait.

-- 
GitHub Notification of comment by fuchsia
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/335#issuecomment-323339695 using your GitHub account

Received on Friday, 18 August 2017 12:24:49 UTC