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]