- From: Sam Richard via GitHub <sysbot+gh@w3.org>
- Date: Fri, 18 Jan 2019 15:39:05 +0000
- To: public-houdini-archive@w3.org
Snugug has just created a new issue for https://github.com/w3c/css-houdini-drafts:
== [css-properties-values-api] Allowed Values/Property Validation ==
I'm looking to do something akin to creating constant custom properties for things like style guides, and I thought I was going to be clever hacking it with `syntax` but that doesn't work for items like colors where I still want browsers to know the property is a color not just a random ident. Ideally, I'd be able to do something like the following:
```javascript
CSS.registerProperty({
name: '--my-blue',
syntax: '<color>',
inherits: true,
allowedValues: ['#4285f4'],
});
CSS.registerProperty({
name: '--highlight-color',
syntax: '<color>',
allowedValues: ['#4285f4', '#ea4335', '#fbbc04'],
initialValue: '#4285f4',
});
```
Alternatively to this, providing a validation hook that could either be created at registration time or picked up in JavaScript later if using the [`@property` syntax](https://github.com/w3c/css-houdini-drafts/pull/847)
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/851 using your GitHub account
Received on Friday, 18 January 2019 15:39:06 UTC