-
Notifications
You must be signed in to change notification settings - Fork 142
Description
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 addednoneas 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:
0for<number>and<integer>- 0{unit} for any dimension type (
<length>,<angle>,<percentage>,<length-percentage>etc) transparentfor<color>image(transparent)for<image>- keyword → itself
For more complex syntax constructs, a suitable initial value can be generated recursively:
A | B→AA+→AA#→ A
cc @tabatkins