Re: [svgwg] Potentially invalid value for dasharray (#642)

Yes, most SVG 1 properties were defined to allow comma and/or whitespace separation of tokens, interchangeably. A single value can use a mix of commas and spaces. For example, you could put a comma after every dash length / gap length pair.

Combination multipliers were adopted when converting SVG to use the CSS grammar.  The syntax `<token>#*` was intended to represent `[<token>#]*`, meaning any number of space-separated repeats of at least one comma-separated repeat of that token.

However, that syntax was previously discussed and decided against in https://github.com/w3c/svgwg/issues/191
That resulted in the changes in cd8915c239378e734a685f28ee59fe26c2515845 (which confusingly refers to a much later issue number in the commit text!). The chosen replacement uses square brackets for explicit grouping, as in [the syntax definition for the `points` attribute](https://svgwg.org/svg2-draft/single-page.html#shapes-DataTypePoints).

The `stroke-dasharray` definition was clearly overlooked in that clean-up, probably because it uses the  `*` multiplier (any number, including none) instead of the `+` multiplier (one or more).

Since there always needs to be at least one token in the dasharray for it to be valid, it should also use the `+` multiplier.  And the square brackets would clarify:

```
<dasharray> = [ [ <length-percentage> | <number> ]+ ]#
```

Perhaps we could also add a note explaining this syntax in [the section on SVG attribute syntaxes](https://svgwg.org/svg2-draft/types.html#syntax).  We should also somewhere normatively state how these mixed-separator values are serialized, if that doesn't already exist.

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

Received on Sunday, 17 March 2019 16:25:09 UTC