Re: [csswg-drafts] [css-conditional] Make CSSSupportsRule expose whether its condition is met (#4240)

Proposed edits, @SebastianZ and @emilio let me know if this works okay:

```diff
diff --git a/css-conditional-3/Overview.bs b/css-conditional-3/Overview.bs
index 35f48ca58..9324b8637 100644
--- a/css-conditional-3/Overview.bs
+++ b/css-conditional-3/Overview.bs
@@ -793,6 +793,7 @@ The {{CSSMediaRule}} interface represents a ''@media'' at-rule:
 [Exposed=Window]
 interface CSSMediaRule : CSSConditionRule {
     [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
+    readonly attribute bool matches;
 };
 </pre>
 
@@ -808,6 +809,14 @@ js/CSSConditionRule.html
     for the list of media queries specified with the ''@media'' at-rule.
     <wpt title=".media returns a MediaList matching the @media condition."></wpt>
 
+  <dt><code>matches</code> of type {{bool}}, readonly
+  <dd>The <code>matches</code> attribute returns true
+    if the rule is in an stylesheet attached to a document
+    whose {{Window}} matches this rule’s {{CSSMediaRule/media}} [=media query=],
+    and returns false otherwise.
+
+    ISSUE: Stylesheet attached to a document isn't a well-defined concept right now.
+
   <dt><code>conditionText</code> of type <code>CSSOMString</code> (CSSMediaRule-specific definition for attribute on CSSConditionRule)
   <dd>The <code>conditionText</code> attribute (defined on the <code>CSSConditionRule</code> parent rule),
     on getting, must return the value of <code>media.mediaText</code> on the rule.
@@ -827,6 +836,7 @@ The {{CSSSupportsRule}} interface represents a ''@supports'' rule.
 <pre class='idl'>
 [Exposed=Window]
 interface CSSSupportsRule : CSSConditionRule {
+    readonly attribute bool matches;
 };
 </pre>
 
@@ -836,6 +846,10 @@ js/CSSConditionRule.html
 <wpt title="CSSSupportsRule represents an @supports rule."></wpt> -->
 
 <dl class='idl-attributes'>
+  <dt><code>matches</code> of type {{bool}}, readonly
+  <dd>The <code>matches</code> attribute returns the evaluation of
+      the [=CSS feature query=] represented in {{CSSConditionRule/conditionText}}.
+
   <dt><code>conditionText</code> of type <code>CSSOMString</code> (CSSSupportsRule-specific definition for attribute on CSSConditionRule)
   <dd>The <code>conditionText</code> attribute (defined on the <code>CSSConditionRule</code> parent rule),
     on getting, must return the condition that was specified,
```

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


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

Received on Wednesday, 24 August 2022 21:13:02 UTC