Re: [csswg-drafts] [css-conditional-3] Define `<declaration>` (#8795)

To clarify my previous comment, since it took me a few minutes to remember...

If `unknown: 1` or `color: invalid` were not matching `<declaration>`, then `@import 'sheet.css' supports(unknown: 1)` would be invalid, which does not conform to the spec. The grammar is `@import ... supports(<declaration>)` (simplified).

With `@supports (unknown: 1) {}`, the grammar is `@supports (<declaration> | <any-value>)` (also simplified). Parsing `unknown: 1` as an invalid `<declaration>` saves time when evaluating `@supports` to determine if its contents must be applied by the UA, because it would be probably marked as `<any-value>` (`<general-enclosed>`), so they do not neet to re-evaluate its support for the `<declaration>`.

So I propose to make `<supports-decl>` invalid when the UA does not support its `<declaration>`, instead of `<declaration>`. 

I do not like making a grammar sensitive to browser support (which it already is with `<declaration>`), so it would wise to discuss more about it.


```diff
  Style sheets <strong>must not</strong> use such a rule and
  processors <strong>must</strong> ignore such a rule (including all of its contents).
+
+ If the UA does not [=support=] the declaration within the parentheses,
+ <<supports-decl>> is invalid.
```

```diff
  : <<supports-decl>>
  ::
-  The result is true if the UA [=supports=] the declaration within the parentheses.
+  The result is true.
```

```diff
  If a processor does not implement, with a usable level of support,
  both the property and the value given,
  then it <strong>must not</strong>
- accept the declaration or claim support for it.
+ claim support for it.
```

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


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

Received on Wednesday, 24 July 2024 12:14:01 UTC