Re: extra commas in path data

Hi,

> On 1/29/11 10:02 PM, ddailey wrote:
>> At http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation, the
>> spec says "Superfluous white space and separators such as commas can be
>> eliminated."
> 
> That's eliminated while _authoring_ a path (as in, you don't have to put them in), not while _parsing_ it.  The spec doesn't say anything about allowing authors to insert extra commas, on the other hand...
> 
> -Boris
> 

the BNF of Path indeed looks like this:
drawto-command wsp* drawto-commands
moveto-drawto-command-group wsp* moveto-drawto-command-groups
so Opera and WebKit are wrong. Even if it is no problem to fix this in WebKit, wouldn't it make more sense to allow commas after a command sequence? The BNF could look like this:

svg-path:
    wsp* moveto-drawto-command-groups? wsp-opt-comma*
moveto-drawto-command-groups:
    moveto-drawto-command-group
    | moveto-drawto-command-group wsp-opt-comma* moveto-drawto-command-groups
moveto-drawto-command-group:
    moveto wsp-opt-comma* drawto-commands?
drawto-commands:
    drawto-command
    | drawto-command wsp-opt-comma* drawto-commands

...

wsp-opt-comma:
    wsp* comma? wsp*

This means M 336,325  ,  , Q 251,325  251,292 would be supported as well. In other words: skip all white spaces and commas up to the next character.

Cheers,
Dirk

Received on Sunday, 30 January 2011 07:53:20 UTC