Skip to content

Commit 037dbfa

Browse files
authored
Define CSSOM for @Custom-Media (#12525)
1 parent b281eeb commit 037dbfa

File tree

1 file changed

+27
-41
lines changed

1 file changed

+27
-41
lines changed

mediaqueries-5/Overview.bs

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,54 +2706,40 @@ Script-based Custom Media Queries</h3>
27062706
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
27072707
██████ ██████ ██████ ███████ ██ ██
27082708
-->
2709-
<!--
2709+
27102710
<h2 id='custom-mq-cssom'>
27112711
CSSOM</h2>
27122712

2713-
The <a interface>CSSRule</a> interface is extended as follows:
2714-
2715-
<pre class="idl partial">
2716-
partial interface CSSRule {
2717-
const unsigned short CUSTOM_MEDIA_RULE = 17;
2718-
};
2719-
</pre>
2720-
2721-
The <a interface>CSSCustomMediaRule</a> interface represents a ''@custom-media'' rule.
2722-
2723-
<pre class="idl">
2724-
[Exposed=Window]
2725-
interface CSSCustomMediaRule : CSSRule {
2726-
attribute CSSOMString name;
2727-
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
2728-
};
2729-
</pre>
2730-
2731-
<dl dfn-type=attribute dfn-for=CSSCustomMediaRule>
2732-
<dt><dfn>name</dfn>, of type <code>CSSOMString</code>
2733-
<dd>
2734-
The <a attribute>name</a> attribute on getting must return a <code>CSSOMString</code> object
2735-
that contains the serialization of the <<extension-name>> defined for the associated rule.
2736-
2737-
On setting the <a attribute>name</a> attribute,
2738-
run the following steps:
2713+
The {{CSSCustomMediaRule}} interface represents a ''@custom-media'' rule.
27392714

2740-
<ol>
2741-
<li><a>Parse a component value</a> from the value.
2715+
<pre class="idl" export>
2716+
typedef (MediaList or boolean) CustomMediaQuery;
27422717

2743-
<li>
2744-
If the returned value is an <<extension-name>>,
2745-
replace the associated rule's name with the <<extension-name>>'s representation.
2718+
[Exposed=Window, RuntimeEnabled=CSSCustomMedia]
2719+
interface CSSCustomMediaRule : CSSRule {
2720+
readonly attribute CSSOMString name;
2721+
readonly attribute CustomMediaQuery query;
2722+
};
2723+
</pre>
27462724

2747-
<li>
2748-
Otherwise, do nothing.
2749-
</ol>
2725+
<dl dfn-type=attribute dfn-for=CSSCustomMediaRule>
2726+
<dt><dfn>name</dfn>
2727+
<dd>
2728+
Returns a CSSOMString representing the <<extension-name>> of the ''@custom-media'' rule.
27502729

2751-
<dt><dfn>media</dfn>, of type <a interface>MediaList</a>, readonly
2752-
<dd>
2753-
The <a attribute>media</a> attribute must return a <a interface>MediaList</a> object
2754-
for the <<media-query-list>> specified with the associated rule.
2755-
</dl>
2756-
-->
2730+
<dt><dfn>query</dfn>
2731+
<dd>
2732+
Represents the value of the <a>custom media query</a>.
2733+
The returned {{CustomMediaQuery}} will be one of the following:
2734+
<ul>
2735+
<li>A {{MediaList}} object,
2736+
if the rule was defined with a <<media-query-list>>.
2737+
<li>The boolean true,
2738+
if the rule was defined with the value <a value for="@custom-media">true</a>.
2739+
<li>The boolean false,
2740+
if the rule was defined with the value <a value for="@custom-media">false</a>.
2741+
</ul>
2742+
</dl>
27572743

27582744
<!--
27592745
██ ██ ██████ ████████ ████████ ████████ ████████ ████████ ████████ ██████

0 commit comments

Comments
 (0)