Skip to content

The syntax for stroke-dasharray in the webref/css package does not match the syntax in the specification #1533

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

Open
stof opened this issue Apr 29, 2025 · 3 comments

Comments

@stof
Copy link

stof commented Apr 29, 2025

This package defines the syntax for stroke-dasharray as none | [<length-percentage> | <number>]+#.
The spec at https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-dasharray defines it as none | <length-percentage>+#.

Full definition of the property in the fill-stroke.json file
    {
      "name": "stroke-dasharray",
      "href": "https://drafts.fxtf.org/fill-stroke-3/#propdef-stroke-dasharray",
      "value": "none | [<length-percentage> | <number>]+#",
      "initial": "none",
      "appliesTo": "text and SVG shapes",
      "inherited": "yes",
      "percentages": "relative to the scaled viewport size",
      "computedValue": "as specified",
      "canonicalOrder": "per grammar",
      "animationType": "repeatable list",
      "media": "visual",
      "values": [
        {
          "name": "none",
          "prose": "No dashing: the stroke is drawn continuously.",
          "href": "https://drafts.fxtf.org/fill-stroke-3/#valdef-stroke-dasharray-none",
          "type": "value",
          "value": "none"
        },
        {
          "name": "<length-percentage>+#",
          "prose": "Specifies a dashing pattern to use. Each <length-percentage> value represents the length of the next dash or gap (beginning with the first dash and alternating from there) of the stroke. The pattern repeats over the length of the stroke. (If the number of values is odd, the pattern behaves as if it was duplicated to yield an even number of values.) The dashing pattern is reset and begins anew at the start of each subpath. Negative values are invalid. If all values are zero, it is treated as none.",
          "href": "https://drafts.fxtf.org/fill-stroke-3/#valdef-stroke-dasharray-length-percentage",
          "type": "value",
          "value": "<length-percentage>+#"
        }
      ],
      "styleDeclaration": [
        "stroke-dasharray",
        "strokeDasharray"
      ]
    }
@dontcallmedom
Copy link
Member

see w3c/csswg-drafts#3057 as to why we patched the spec extract

@stof
Copy link
Author

stof commented Apr 29, 2025

Hmm, looks like there was a resolution in 2018 but the spec still does not reflect it 😢

And support for <number> in browsers is not fully interoperable. Firefox supports numbers as a parser quirks, not as a fully supported type, so it does not work with calc() returning a number: https://bugzilla.mozilla.org/show_bug.cgi?id=1679465

@dontcallmedom
Copy link
Member

I think both the lack of spec progress and the interoperability risk are worth bringing up in w3c/csswg-drafts#3057 if you'd be so inclined

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

No branches or pull requests

2 participants