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 897465 of MediaQueryListListener

  • Revision slug: Web/API/MediaQueryListListener
  • Revision title: MediaQueryListListener
  • Revision id: 897465
  • Created:
  • Creator: Sebastianz
  • Is current revision? Yes
  • Comment Added table to 'Specifications' section and fixed page formatting to allow the compat data scraper to parse the page

Revision Content

{{APIRef("CSSOM View")}}{{SeeCompatTable}}

A MediaQueryList object maintains a list of media queries on a {{domxref("document")}}, and handles sending notifications to listeners when the media queries on the document change.

This makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, if you need to detect changes to the values of media queries on a document.

A MediaQueryListListener is a callback function that gets invoked with a single argument, the {{domxref("MediaQueryList")}} for which the evaluated result changed.

Specifications

Specification Status Comment
{{SpecName("CSSOM View", "#the-mediaquerylist-interface", "MediaQueryListListener")}} {{Spec2("CSSOM View")}} Initial definition

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatUnknown}} {{CompatGeckoDesktop("6.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

See also

Revision Source

<div>{{APIRef("CSSOM View")}}{{SeeCompatTable}}</div>

<p>A <code>MediaQueryList</code> object maintains a list of <a href="/en-US/docs/Web/Guide/CSS/Media_queries">media queries</a> on a {{domxref("document")}}, and handles sending notifications to listeners when the media queries on the document change.</p>

<p>This makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, if you need to detect changes to the values of media queries on a document.</p>

<p>A <code>MediaQueryListListener</code> is a callback function that gets invoked with a single argument, the {{domxref("MediaQueryList")}} for which the evaluated result changed.</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th>Specification</th>
   <th>Status</th>
   <th>Comment</th>
  </tr>
  <tr>
   <td>{{SpecName("CSSOM View", "#the-mediaquerylist-interface", "MediaQueryListListener")}}</td>
   <td>{{Spec2("CSSOM View")}}</td>
   <td>Initial definition</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</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoDesktop("6.0")}}</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 Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Web/Guide/CSS/Media_queries">Media queries</a></li>
 <li><a href="/en-US/docs/Web/Guide/CSS/Testing_media_queries">Using media queries from code</a></li>
 <li>{{domxref("MediaQueryList")}}</li>
 <li>{{domxref("window.matchMedia()")}}</li>
</ul>
Revert to this revision