- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Thu, 12 Oct 2023 14:47:18 +0000
- To: public-css-archive@w3.org
LeaVerou has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-properties-values-api] Make `initial-value` descriptor optional == Currently writing `@property` rules is fairly verbose and repetitive. All three descriptors are mandatory, and [often forgotten](https://github.com/search?q=%22%40property%22+language%3Acss&type=code), 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](https://drafts.css-houdini.org/css-properties-values-api/#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: - `A | B` → `A` - `A+` → `A` - `A#` → A cc @tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9463 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 12 October 2023 14:47:20 UTC