Re: [css-houdini-drafts] [css-properties-values-api] Make all the descriptors optional (#994)

All of these are required for good reasons. ^_^

As Amelia said, making `inherits` required is very intentional, to force authors to think about it. Inherited properties are more expensive than non-inherited, and given a choice, we probably shouldn't be defaulting to the more expensive option. Also, yes, having bools default to `true` is weird in JS and we should avoid it whenever possible.

Similarly, `syntax` is required because the `"*"` grammar is not very useful. We need `"*"` so we can support *arbitrary* values, but it's much better for us to guide authors to supplying a meaningful `syntax` that we can actually transition/etc when possible. If they don't need it, `syntax:"*",` is really short to type anyway.

And finally, `initialValue` is required whenever `syntax` isn't `"*"` because the guaranteed-invalid value *doesn't match any specific syntax at all*. We want to ensure that, if you say a custom property is a `"<color>"`, *you get a color when you query that property*.

I'm open to *allowing* the guaranteed-invalid value as part of a custom property's value space; there's nothing wrong with `syntax: "<color> | <guaranteed-invalid>"`. But I don't think it's good to make it easy to include it in your value space by default; I'd rather guide people (via the "missing key" errors) to set up their value space properly.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/994#issuecomment-664707621 using your GitHub account

Received on Tuesday, 28 July 2020 00:31:40 UTC