Skip to content

<path d> parsing spec needs a special case to not use CSS syntax - #620

Closed
SimonSapin wants to merge 1 commit into
w3c:masterfrom
SimonSapin:d
Closed

<path d> parsing spec needs a special case to not use CSS syntax#620
SimonSapin wants to merge 1 commit into
w3c:masterfrom
SimonSapin:d

Conversation

@SimonSapin

Copy link
Copy Markdown

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.

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>`.

w3c#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.
@AmeliaBR

Copy link
Copy Markdown
Contributor

There is an open pull request that is waiting for review about fixing/clarifying the d syntax in attributes vs CSS property: #374

I suspect your concerns are still valid, but if you're able to, it would be helpful if you compared your fixes against those changes.

@SimonSapin

Copy link
Copy Markdown
Author

#374 fixes the same bug that this PR does, in a way that I find satisfactory. It also contains a normative change path(<string>) v.s. <string>, I don’t really have an opinion about that.

@AmeliaBR

Copy link
Copy Markdown
Contributor

Ok, thanks for checking Simon, and thanks for the effort of the PR even if it turned out to be a duplicate.

@AmeliaBR AmeliaBR closed this Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants