Re: [svgwg] Floating point number format discordance (SVG vs CSS vs browsers)

Repost of the comment I made in #347:

``` 
<polygon  stroke="black" fill="red"  points=" 0. 32.   32. 0.  64. 32."/> 
<polyline stroke="black" fill="none" points="96. 32.  128. 0. 160. 32."/> 
``` 
The above draws a triangle and a chevron in SVG 1.1; but draws nothing in SVG 2.

That's because, in SVG 1.1, [the points attribute is defined](https://www.w3.org/TR/SVG/shapes.html#PointsBNF)  using a bespoke grammer which allow trailing dots on numbers. Whereas [SVG2 uses](https://svgwg.org/svg2-draft/shapes.html#DataTypePoints) the CSS definition of [`<number-token>`](https://drafts.csswg.org/css-syntax-3/#number-token-diagram) which prohibits trailing dots, stopping the above rendering.

Is this intentional? If so, what's the rational for changing it here and not on pathdata?

It's probably worth pointing out that SVG 1.1 is inconsistent with itself: it allows trailing dots in pathdata and the points attribute, but prohibits them on all other [numbers](https://www.w3.org/TR/SVG11/types.html#DataTypeNumber). So 
``` 
<line stroke="black" x1="288." y1="0." x2="320." y2="32."/> 
```
is illegal. To me that suggests permitting them at all was bug in SVG 1.1.

Compatibility table: trailing dots allowed on numbers?
---------------------------------------------------------

Desktop Browser |   points |    pathdata  |  general number attributes
----------------|----------|--------------|-------------
Chrome  62.0    |   no     |    no        |  yes
Firefox 55.0.3  |   no     |    no        |  no
Edge    ???     |   yes    |    yes       |  yes
Safari  10.1.2  |   no     |    no        |  no

Derived by running [this fiddle](https://jsfiddle.net/qdoem0ta/) and seeing what renders.
```
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="352px" height="96px">
  <polygon stroke="black" fill="red" points="0. 32.  32. 0.  64. 32." />
  <polyline stroke="black" fill="none" points="96. 32.  128. 0. 160. 32." />
  <path stroke="black" fill="red" d="M 192. 32. 224. 0. 256. 32." />
  <line stroke="black" x1="288." y1="0." x2="320." y2="32." />

  <text x="32" y="48" dominant-baseline="middle" text-anchor="middle">polygon</text>
  <text x="128" y="48" dominant-baseline="middle" text-anchor="middle">polyline</text>
  <text x="224" y="48" dominant-baseline="middle" text-anchor="middle">path</text>
  <text x="304" y="48" dominant-baseline="middle" text-anchor="middle">line</text>
</svg>
```

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

Received on Monday, 2 October 2017 08:51:24 UTC