- From: Boris Dalstein via GitHub <sysbot+gh@w3.org>
- Date: Tue, 10 Dec 2019 15:30:58 +0000
- To: public-svg-issues@w3.org
dalboris has just created a new issue for https://github.com/w3c/svgwg: == points-attribute: whitespaces and empty strings in SVG 1.1 vs SVG 2 == **Short version** According to the spec, there is a backward incompatible change between SVG 1.1 and SVG 2 for the `points` attribute. In SVG 1.1, "100-200" is valid, but "100 200-300 400" is invalid. Beside, an empty string is valid (no points). In SVG 2, depending on how you interpret `<number>+`, either "100-200" is invalid, or "100 200-300 400" is valid. Besides, an empty string is invalid. **Long version** In SVG 1.1, the `points` attribute of `<polyline>` and `<polygon>` elements is defined via a BNF grammar (I renamed the symbols for conciseness): https://www.w3.org/TR/SVG11/shapes.html#PointsBNF ``` points: wsp* coord-pairs? wsp* coord-pairs: coord-pair | coord-pair cw coord-pairs // Mandatory cw coord-pair: coord cw coord | coord neg-coord // Optional cw if 2nd coord is neg coord: sign? integer | sign? float neg-coord: "-" integer | "-" float cw: (wsp+ comma? wsp*) | (comma wsp*) [...] ``` Therefore, according to the grammar, this makes "100-200" valid, but "100 200-300 400" invalid. In other words: - Within a coord-pair, if the second coord is negative, then it MAY follow the first coord without a whitespace or comma. - Between coord-pairs, the pairs MUST be separated by either a comma or at least one whitespace (or both) Besides, note that due to the question mark in `coord-pairs?`, an empty string, or a string made of whitespaces only, is valid in SVG 1.1. However, in SVG 2, the `points` attribute is defined via the CSS Value syntax: https://svgwg.org/svg2-draft/shapes.html#DataTypePoints ``` <points> = [ <number>+ ]# ``` Where `+` means "one or more times", and `#` means "one or more times, separated by commas". See: https://www.w3.org/TR/css3-values/#component-multipliers I'm not 100% sure whether `<number>+` means 1+ whitespace mandatory between numbers, but: - Either 1+ whitespace is mandatory, in which case "100-200" is now invalid - Either whitespaces are optional, in which case "100 200-300 400" is now valid Besides, the SVG 2 definition mandates at least one number, so an empty string, or a string made of whitespaces only, is not anymore valid as per spec. Somehow related: #347, #644 Please view or discuss this issue at https://github.com/w3c/svgwg/issues/763 using your GitHub account
Received on Tuesday, 10 December 2019 15:30:59 UTC