Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 337389 of CSSMediaRule

  • Revision slug: DOM/CSSMediaRule
  • Revision title: CSSMediaRule
  • Revision id: 337389
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSOMRef() }}

CSSMediaRule is an object representing a single CSS {{cssxref("@media")}} rule. It implements the {{domxref("CSSConditionRule")}} interface.

Syntax

The syntax is described using the WebIDL format.

interface CSSMediaRule : CSSConditionRule {
    readonly attribute MediaList media;
}

Properties

As a {{ domxref("CSSConditionRule") }}, and therefore both a {{domxref("CSSGroupingRule")}} and  a {{ domxref("CSSRule") }}, CSSSupportsRule also implements the properties of these interfaces. It has the following specific property:

media {{readonlyinline()}}
Specifies a {{domxref("MediaList")}} representing the intended destination medium for style information.

Methods

As a {{ domxref("CSSConditionRule") }}, and therefore both a {{domxref("CSSGroupingRule")}} and  a {{ domxref("CSSRule") }}, CSSSupportsRule also implements the methods of that interface. It has no specific methods.

Specification

Specification Status Comment
{{ SpecName('CSS3 Conditional', '#the-cssmediarule-interface', 'CSSMediaRule') }} {{ Spec2('CSS3 Conditional')}} Make it derived from the {{domxref("CSSConditionRule")}}.
{{ SpecName('CSSOM', '#the-cssmediarule-interface', 'CSSMediaRule') }} {{ Spec2('CSSOM') }} No changes from {{SpecName('DOM2 Style')}}
{{SpecName('DOM2 Style', 'css.html#CSS-CSSMediaRule', 'CSSMediaRule') }} {{ Spec2('DOM2 Style') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{ CompatUnknown() }} {{ CompatVersionUnknown }} [1] {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatGeckoMobile("17") }} [1] {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

[1] Setting the value of conditionText on Gecko is only possible from Firefox 20 onwards.

See also

  • {{CSSOM}}

Revision Source

<p>{{ CSSOMRef() }}</p>
<p><strong><code>CSSMediaRule</code></strong> is an object representing a single CSS {{cssxref("@media")}} rule. It implements the {{domxref("CSSConditionRule")}} interface.</p>
<h2 id="Syntax">Syntax</h2>
<p>The syntax is described using the <a href="https://dev.w3.org/2006/webapi/WebIDL/" title="https://dev.w3.org/2006/webapi/WebIDL/">WebIDL</a> format.</p>
<pre>
interface CSSMediaRule : CSSConditionRule {
    readonly attribute MediaList media;
}
</pre>
<h2 id="Properties" name="Properties">Properties</h2>
<p>As a {{ domxref("CSSConditionRule") }}, and therefore both a {{domxref("CSSGroupingRule")}} and&nbsp; a {{ domxref("CSSRule") }}, <code>CSSSupportsRule</code> also implements the properties of these interfaces. It has the following specific propert<code>y:</code></p>
<dl>
  <dt>
    <code>media</code> {{readonlyinline()}}</dt>
  <dd>
    Specifies a {{domxref("MediaList")}} representing the intended destination medium for style information.</dd>
</dl>
<h2 id="Methods" name="Methods">Methods</h2>
<p>As a {{ domxref("CSSConditionRule") }}, and therefore both a {{domxref("CSSGroupingRule")}} and&nbsp; a {{ domxref("CSSRule") }}, <code>CSSSupportsRule</code> also implements the methods of that interface. It has no specific methods.</p>
<h2 id="Specification" name="Specification">Specification</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ SpecName('CSS3 Conditional', '#the-cssmediarule-interface', 'CSSMediaRule') }}</td>
      <td>{{ Spec2('CSS3 Conditional')}}</td>
      <td>Make it derived from the {{domxref("CSSConditionRule")}}.</td>
    </tr>
    <tr>
      <td>{{ SpecName('CSSOM', '#the-cssmediarule-interface', 'CSSMediaRule') }}</td>
      <td>{{ Spec2('CSSOM') }}</td>
      <td>No changes from {{SpecName('DOM2 Style')}}</td>
    </tr>
    <tr>
      <td>{{SpecName('DOM2 Style', 'css.html#CSS-CSSMediaRule', 'CSSMediaRule') }}</td>
      <td>{{ Spec2('DOM2 Style') }}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari (WebKit)</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatVersionUnknown }} [1]</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE&nbsp;Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatGeckoMobile("17") }} [1]</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<p>[1] Setting the value of <code>conditionText</code> on Gecko is only possible from Firefox 20 onwards.</p>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{CSSOM}}</li>
</ul>
Revert to this revision