W3C home > Mailing lists > Public > www-svg@w3.org > March 2010

Negative values in polygon/polyline points

From: Jeff Schiller <codedread@gmail.com>
Date: Mon, 22 Mar 2010 16:01:10 -0600
Message-ID: <da131fde1003221501v5ac9605h4ff52416d527b351@mail.gmail.com>
To: www-svg <www-svg@w3.org>
Two-part question.

1) The SVG spec states that superfluous whitespace (and comma) can be
removed from the path's d attribute [1] so that

    L 100, -100

can be written as

    L100-100

Is this described in the EBNF grammar [2] ?  I'm not a EBNF expert but
couldn't find that.  If this is not something you can effectively
represent in EBNF, could an example be added to the bulleted list of
shortcuts so that it is clear that negative coordinates can be handled
this way?

2) My second question is whether this grammar also applies to the
polygon/polyline points attribute?  Can

    points="100, -100"

be rewritten as

    points="100-100"

Doing a quick test shows that Opera, WebKit and IE9 support this
shortcut but Firefox does not.  I couldn't find the rule in the
grammar.

Here's my test file:

<?xml version='1.0' encoding='utf-8'?>
<svg xmlns="http://www.w3.org/2000/svg">
 <polygon fill="red" transform="translate(100,100)"
points="0,0,100,0,100,-100,0,-100" />
 <polygon fill="green" transform="translate(100,100)"
points="0,0,100,0,100-100,0-100" />
</svg>

Since most browsers seem to support it and it aligns with path's @d I
guess it would make sense to allow it.  Can you clarify the points
grammar [3] in a similar fashion?

Thanks,
Jeff Schiller

[1] http://dev.w3.org/SVG/profiles/1.1F2/publish/paths.html#PathDataGeneralInformation
[2] http://dev.w3.org/SVG/profiles/1.1F2/publish/paths.html#PathDataBNF
[3] http://dev.w3.org/SVG/profiles/1.1F2/publish/shapes.html#PointsBNF
Received on Monday, 22 March 2010 22:01:42 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:44 GMT