-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[css-values] Grammar syntax for defining default values for optional productions #11189
Comments
To make this more concrete, and show some weaknesses, here are some additional examples of where this could be used: CSS Images 4 https://drafts.csswg.org/css-images-4/#typedef-linear-gradient-syntax
https://drafts.csswg.org/css-images-4/#radial-gradients https://drafts.csswg.org/css-images-4/#typedef-conic-gradient-syntax
https://drafts.csswg.org/css-images-4/#stripes
CSS Shapes https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-inset
and example using made up but hopefully understandable synax for how the "margin" rules could be specified would be something like:
https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-xywh
https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-rect
https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-circle
https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-ellipse
https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-polygon
https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-path
CSS Filters Filters give some interesting cases. A lot is covered, but missing is syntax to specify:
https://drafts.fxtf.org/filter-effects/#funcdef-filter-blur
https://drafts.fxtf.org/filter-effects/#funcdef-filter-brightness
https://drafts.fxtf.org/filter-effects/#funcdef-filter-contrast
https://drafts.fxtf.org/filter-effects/#funcdef-filter-drop-shadow
https://drafts.fxtf.org/filter-effects/#funcdef-filter-grayscale
https://drafts.fxtf.org/filter-effects/#funcdef-filter-hue-rotate
https://drafts.fxtf.org/filter-effects/#funcdef-filter-invert
https://drafts.fxtf.org/filter-effects/#funcdef-filter-opacity
https://drafts.fxtf.org/filter-effects/#funcdef-filter-saturate
https://drafts.fxtf.org/filter-effects/#funcdef-filter-sepia
|
As part of an ongoing effort to generate the parsing and serialization of CSS values from the grammars in specs, one of the most prominent missing pieces of information is the prose defined "default values" for optional productions.
To give some concrete examples, lets take a look at the grammar for the
blur()
function:In prose below the grammar is the text "Default value when omitted is 0px."
If instead, that information was available in a machine readable way, parsing and serialization of would be directly implementable.
This would similarly be beneficial for testing.
I don't have strong opinions on the specifics of a syntax extension, so as a strawman I propose
?=[default value here]
.For the example above, this might look like:
This won't work for everything, some defaults are quite complicated, but I think it would move things forward.
The text was updated successfully, but these errors were encountered: