Skip to content

Commit 3dab354

Browse files
committed
[css-conditional-3] Add .matches to @media and @supports, w3c#4240
1 parent f1d42e6 commit 3dab354

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

css-conditional-3/Overview.bs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ The {{CSSMediaRule}} interface represents a ''@media'' at-rule:
793793
[Exposed=Window]
794794
interface CSSMediaRule : CSSConditionRule {
795795
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
796+
readonly attribute bool matches;
796797
};
797798
</pre>
798799

@@ -808,6 +809,13 @@ js/CSSConditionRule.html
808809
for the list of media queries specified with the ''@media'' at-rule.
809810
<wpt title=".media returns a MediaList matching the @media condition."></wpt>
810811

812+
<dt><code>matches</code> of type {{bool}}, readonly
813+
<dd>The <code>matches</code> attribute returns true
814+
if the rule is in an stylesheet attached to a document
815+
whose {{Window}} matches this rule’s {{CSSMediaRule/media}} [=media query=],
816+
and returns false otherwise.
817+
<wpt title=".matches matches the media query, returns boolean."></wpt>
818+
811819
<dt><code>conditionText</code> of type <code>CSSOMString</code> (CSSMediaRule-specific definition for attribute on CSSConditionRule)
812820
<dd>The <code>conditionText</code> attribute (defined on the <code>CSSConditionRule</code> parent rule),
813821
on getting, must return the value of <code>media.mediaText</code> on the rule.
@@ -823,6 +831,7 @@ The {{CSSSupportsRule}} interface represents a ''@supports'' rule.
823831
<pre class='idl'>
824832
[Exposed=Window]
825833
interface CSSSupportsRule : CSSConditionRule {
834+
readonly attribute bool matches;
826835
};
827836
</pre>
828837

@@ -832,6 +841,11 @@ js/CSSConditionRule.html
832841
<wpt title="CSSSupportsRule represents an @supports rule."></wpt> -->
833842

834843
<dl class='idl-attributes'>
844+
<dt><code>matches</code> of type {{bool}}, readonly
845+
<dd>The <code>matches</code> attribute returns the evaluation of
846+
the [=CSS feature query=] represented in {{CSSConditionRule/conditionText}}.
847+
<wpt title="CSSSupportsRule.matches returns true if matches feature query"></wpt>
848+
835849
<dt><code>conditionText</code> of type <code>CSSOMString</code> (CSSSupportsRule-specific definition for attribute on CSSConditionRule)
836850
<dd>The <code>conditionText</code> attribute (defined on the <code>CSSConditionRule</code> parent rule),
837851
on getting, must return the condition that was specified,

0 commit comments

Comments
 (0)