Skip to content

Commit 125c975

Browse files
committed
<path d> parsing spec needs a special case to not use CSS syntax
When reading the spec literally before this changes, https://svgwg.org/svg2-draft/styling.html#PresentationAttributes specifies that all presentation properties are parsed according to https://svgwg.org/svg2-draft/types.html#presentation-attribute-css-value For the `d` property, this means the CSS grammar `none | <string>`. The following would be valid: * `<path d="none">` * `<path d="'M 100 100 L 300 100 L 200 300 z'">` (not the single quotes) * `<path d="/**/'M 100 100 \L \33 00 100 L 200 300 z'">` (equivalent to the previous) But `<path d="M 100 100 L 300 100 L 200 300 z">` or indeed any SVG 1.1 path would not be valid because they parse as CSS ident and number tokens, not as a `<string>`. #320 poposes changing the syntax of the `d` CSS propery to be even further to the 1.1 attribute syntax. This does not appear to be an intentional change from SVG 1.1, so this pull request "reverts" it.
1 parent 61200d7 commit 125c975

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

master/styling.html

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,9 @@ <h2 id="PresentationAttributes">Presentation attributes</h2>
314314
<p>Since presentation attributes are parsed as CSS values, not declarations, an
315315
<a href="https://www.w3.org/TR/2011/REC-CSS2-20110607/cascade.html#important-rules"><span class="prop-value">!important</span> declaration</a>
316316
within a presentation attribute will cause it to have an <a>invalid value</a>.
317-
See <a href="types.html#presentation-attribute-css-value">Attribute syntax</a>
318-
for details on how presentation attributes are parsed.</p>
317+
Except as noted in thetable for the <a>'d'</a> presentation attribute,
318+
the value of presentation attributes is parsed
319+
<a href="types.html#presentation-attribute-css-value">using the CSS Value Definition Syntax</a>.
319320

320321
<p>Not all style properties that can affect SVG rendering have a corresponding
321322
presentation attribute.
@@ -382,6 +383,20 @@ <h2 id="PresentationAttributes">Presentation attributes</h2>
382383
</td>
383384
<td>
384385
<a>'path'</a>
386+
<p>
387+
Unlike other presentation attributes,
388+
the value is not parsed as CSS syntax
389+
but directly according to the <a href="#PathDataBNF">svg-path</a>
390+
<a href="types.html#syntax">EBNF grammar</a>,
391+
and errors within the string are handled according to the rules in the
392+
<a href="paths.html#PathDataErrorHandling">Path Data Error Handling</a> section.
393+
</p>
394+
<p class="note">
395+
In particular, the attribute value does not accept the <code>none</code> keyword,
396+
does not have the quotes of a CSS <a>&lt;string&gt;</a> token
397+
(in addition to those delimiting the attribute value in XML or HTML syntax),
398+
and does not unescape CSS backslash-escapes.
399+
</p>
385400
</td>
386401
</tr>
387402
<tr>

0 commit comments

Comments
 (0)