CSS.supports() API in Firefox Nightly

  ·   As a followup to this post announcing the @supports at-rule implementation, Firefox Nightly now (as of bug 779917) has support for the DOM API part of the CSS Conditional Rules Level 3 specification. The new CSS.supports function can be called in two different ways. The first is with a property name and value pair:

if (CSS.supports("display", "flex")) {
  // do something relying on flexbox
}

The second is with an entire expression that can appear just after @supports:

if (CSS.supports("(display: flex) and (display: grid)")) {
  // do something relying on flexbox and grid layout
}

As with the @supports rule itself, the CSS.supports() API lives behind the layout.css.supports-rule.enabled pref, which is enabled by default in Nightly and Aurora builds of Firefox.

[Edited 28 December 2012 – fixed display: flexbox to display: flex as pointed out by fantasai]


Two comments

You can subscribe to the comment feed to follow the responses to this entry.

  1. [...] standardmäßig aktiviert wurde nun die Unterstützung für CSS @supports und der entsprechenden DOM-API, worüber der Browser gefragt werden kann, ob er eine bestimmte CSS-Deklaration versteht, und [...]

  2. [...] standardmäßig aktiviert wurde nun die Unterstützung für CSS @supports und der entsprechenden DOM-API, über welche der Browser gefragt werden kann, ob er eine bestimmte CSS-Deklaration versteht, und [...]

Leave a comment