Skip to content

Commit

Permalink
Merge pull request #697 from w3c/fix-331
Browse files Browse the repository at this point in the history
Align path number parsing with CSS Numbers. Fixes #331 #335
  • Loading branch information
dirkschulze authored Jun 20, 2019
2 parents 760f6d9 + ef44177 commit 8612240
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
33 changes: 26 additions & 7 deletions master/paths.html
Original file line number Diff line number Diff line change
Expand Up @@ -881,10 +881,20 @@ <h3 id="PathDataBNF">The grammar for path data</h3>
coordinate::= sign? number

sign::= "+"|"-"
number ::= ([0-9])+
flag::=("0"|"1")
comma_wsp::=(wsp+ ","? wsp*) | ("," wsp*)
wsp ::= (#x9 | #x20 | #xA | #xC | #xD)

exponent::= ("e" | "E") sign? digit+

fractional-constant::= (digit* "." digit+) | digit+

number::= fractional-constant exponent?

flag::= ("0" | "1")

comma_wsp::= (wsp+ ","? wsp*) | ("," wsp*)

wsp::= (#x9 | #x20 | #xA | #xC | #xD)

digit::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
</pre>

<p>The processing of the EBNF must consume as much of a given
Expand All @@ -904,9 +914,18 @@ <h3 id="PathDataBNF">The grammar for path data</h3>
that the first coordinate will be "0.6" and the second
coordinate will be ".5".</p>

<p>Note that the EBNF allows the path data string in the
<a>'d'</a> property to be empty. This is not
an error, instead it disables rendering of the path.
<p class="advisement">The
<a href="https://www.w3.org/Graphics/SVG/1.1/paths.html#PathDataBNF">grammar
of previous specifications</a> allowed a trailing decimal point without
any decimal digits for numbers (e.g <code>23.</code>). SVG 2 harmonizes number parsing
with CSS [<a href="refs.html#ref-css-syntax-3">css-syntax-3</a>],
disallowing the relaxed grammar for numbers. However, user agents may continue
to accept numbers with trailing decimal points when parsing is unambiguous.
Authors and authoring tools must not use the disallowed number format.</p>

<p>The EBNF allows the path data string in the
<a>'d'</a> property to be empty. An empty path data string
disables rendering of the path.
Rendering is also disabled when the <a>'d'</a> property
has the value <span class='prop-value'>none</span>.</p>

Expand Down
9 changes: 9 additions & 0 deletions master/refs.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,15 @@ <h2 id="InformativeReferences">Informative references</h2>
edition of CSS Shapes 2</a> is available at
http://dev.w3.org/csswg/css-shapes-2/.
</dd>
<dt id="ref-css-syntax-3" class="informref">[<a href="http://dev.w3.org/csswg/css-syntax-3/">css-syntax-3</a>]</dt>
<dd>
<cite class="w3cwd"><a href="http://dev.w3.org/csswg/css-syntax-3/">CSS Syntax Module Level 3</a></cite>,
Tab Atkins ed.
World Wide Web Consortium, February 2014.
<br/>The <a href="http://dev.w3.org/csswg/css-syntax-3/">latest
edition of CSS Syntax 3</a> is available at
http://dev.w3.org/csswg/css-syntax-3/.
</dd>

<dt id="ref-css-animations-1" class="informref">[<a href="https://www.w3.org/TR/css-animations-1/">css-animations-1</a>]</dt>
<dd><div>Dean Jackson; David Hyatt; Chris Marrin; Sylvain Galineau; David Baron. <a href="https://www.w3.org/TR/css-animations-1/"><cite>CSS Animations</cite></a>. 30 November 2017. W3C Working Draft. URL:&nbsp;<a href="https://www.w3.org/TR/css-animations-1/">https://www.w3.org/TR/css-animations-1/</a> ED:&nbsp;<a href="https://drafts.csswg.org/css-animations/">https://drafts.csswg.org/css-animations/</a></div></dd>
Expand Down

0 comments on commit 8612240

Please sign in to comment.