You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently writing @property rules is fairly verbose and repetitive. All three descriptors are mandatory, and often forgotten, causing hard to debug bugs.
It’s unfortunate that inherits cannot be optional since the only default value that makes sense is also the slowest, but what about initial-value?
I think we can compute a sensible initial value for any syntax string except * (in which case it should be mandatory). In addition to making code shorter, it is often nontrivial to specify a suitable, computationally independent initial value (e.g. for <image>, especially before image() is implemented).
In some cases there is no obvious initial value, but that is a problem for authors as well: there should be a suitable initial value for each value type. If there isn't, it's a bug with the value type.
<url>. Built-in CSS properties solve this by accepting a keyword as well (e.g. none).
<transform-function>: what if we added none as a value? It would be compatible with existing properties, and would mean authors wouldn't need to keep doing <transform-function> | none
<transform-list>, see above
The other elementary types are pretty straight forward:
0 for <number> and <integer>
0{unit} for any dimension type (<length>, <angle>, <percentage>, <length-percentage> etc)
transparent for <color>
image(transparent) for <image>
keyword → itself
For more complex syntax constructs, a suitable initial value can be generated recursively:
Currently writing
@property
rules is fairly verbose and repetitive. All three descriptors are mandatory, and often forgotten, causing hard to debug bugs.It’s unfortunate that
inherits
cannot be optional since the only default value that makes sense is also the slowest, but what aboutinitial-value
?I think we can compute a sensible initial value for any syntax string except
*
(in which case it should be mandatory). In addition to making code shorter, it is often nontrivial to specify a suitable, computationally independent initial value (e.g. for<image>
, especially beforeimage()
is implemented).In some cases there is no obvious initial value, but that is a problem for authors as well: there should be a suitable initial value for each value type. If there isn't, it's a bug with the value type.
<url>
. Built-in CSS properties solve this by accepting a keyword as well (e.g.none
).<transform-function>
: what if we addednone
as a value? It would be compatible with existing properties, and would mean authors wouldn't need to keep doing<transform-function> | none
<transform-list>
, see aboveThe other elementary types are pretty straight forward:
0
for<number>
and<integer>
<length>
,<angle>
,<percentage>
,<length-percentage>
etc)transparent
for<color>
image(transparent)
for<image>
For more complex syntax constructs, a suitable initial value can be generated recursively:
A | B
→A
A+
→A
A#
→ Acc @tabatkins
The text was updated successfully, but these errors were encountered: