Re: [csswg-drafts] [css-cascade][css-syntax] New `!revertable` flag to mark a declaration as "can be reverted when IACVT" (#10443)

> In your example it will be `0`, as no `--registered` is defined with a valid value

Good catch on my code snippet, I forgot that the reverted value needs to conform to the syntax specified.

> I don't know if it is currently possible to determine if an unregistered custom property is invalid before using it? If so, I can see it useful to be able to revert to previous values when doing `!revertable`. 

That's what I'm hoping it can do, I believe currently registered property with "any token" syntax behave the same as unregistered property, correct? So simply doing so doesn't solve the problem.

My simplified use case is follows - I want to create a design system where you can specify width as fractions.

```css
.example {
  width: calc(100% * var(--width));
  --width: 2/3;
  --width: max(invalid) !revertable;
}
```

As you can see here there isn't any syntax I can use other than any token, since "2/3" doesn't conform to any type.

Of course I can use `calc(2/3)` instead, but it's no longer elegantly expressed.

If we can force IACVT checking with `!revertable` then this problem would be solved.

-- 
GitHub Notification of comment by miragecraft
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10443#issuecomment-2405851087 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 10 October 2024 19:10:48 UTC