It has been proposed that CSS3 should include a systematic way to let authors detect features and capabilities of the browsers on which their code is interpreted, thus avoiding unfortunate partial rendering of their pages.
In a simple proposed syntax, a single rule set is
disabled if any of its contained rules fails and is
marked with !supported:
div {
xn: xv !supported;
yn: yv;
}
This is probably good enough for a lot of cases, but
we might want to disable one rule set because of a
failure in another one. One way to do that is to enclose
them both in a @supported
at-rule:
@supported {
div.a {
xn: xv !supported;
}
div.b {
yn: yv;
}
}
That is also like a media query, so why not use the same syntax?:
@media (supports) {
div.a {
xn: xv !supported;
}
div.b {
yn: yv;
}
}
That has the advantage that an unrecognized media query will fail if not itself supported.
Some have suggested to express what the author requires in the query itself:
@media (supports(xn: xv)) {
div.b {
yn: yv;
}
}
div.a {
xn: xv;
}
That's more flexible, as the tested feature does not have to be inside the at-rule, but it's also more verbose. The required feature could go outside using the previous syntax if it were named and then referenced by that name:
@media (supports(stuff)) {
div.b {
yn: yv;
}
}
div.a {
xn: xv !supported(stuff);
}
Can we find use cases for these more sophisticated forms?