Re: [csswg-drafts] [css-properties-values-api] Are fallbacks provided for registered properties validated by the CP syntax? (#10455)

I'm a little confused here, because the issue talks about allowing fallback value that is not checked against the syntax of the registered property, but currently even fallback value that passes the syntax check is not used?

In the codepen: https://codepen.io/leaverou/pen/oNRpEGO

`<pre style="--color: red; background: var(--color, lime);"></pre>` is rendered as yellowgreen, even though lime is a valid syntax of the registered `--color` property.

The WPT test mentioned also confirms this: https://github.com/web-platform-tests/wpt/blob/master/css/css-pseudo/highlight-cascade/highlight-cascade-003.html#L8-L14

```html
<style>
  @property --bg {
    syntax: "<color>";
    inherits: false;
    initial-value: green;
  }
  :root::selection {
    background-color: var(--bg, red);
  }
</style>
<main>PASS if background-color is green when selected</main>
```

Why would it be green if fallback value of red is a valid `<color>`?

I thought the specs say fallback value can be used for registered custom properties: https://drafts.css-houdini.org/css-properties-values-api-1/#fallbacks-in-var-references

If no fallback would ever be applied even if they pass syntax check then what's the point of dropping validation?

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


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

Received on Thursday, 28 November 2024 14:36:20 UTC