Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

SimonSapin
Copy link

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