W3C home > Mailing lists > Public > www-style@w3.org > October 2012

Re: @import and @supports

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Thu, 11 Oct 2012 08:57:52 +0200
Message-ID: <50766DF0.8@kozea.fr>
To: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
CC: WWW Style <www-style@w3.org>
Le 11/10/2012 08:39, Giuseppe Bilotta a écrit :
> Hello all,
>
> I'm looking for a way to import a CSS only if the browser supports
> some feature. However, apparently @import and @supports don't mix: I
> cannot use @import within a @supports block because "@import must
> precede other rules", and @import doesn't allow a @supports-style
> media-query.

Hi Giuseppe,

This is a know issue in the css3-conditional spec. (Noted as Issue 1.) 
As we did not really have a good solution, we resolved just yesterday to 
defer it to level 4 so that the rest of the module can advance quickly.


> Either of these two constraints should be relaxed, either by allowing
> @import inside @supports or by adding @supports-style queries to
> @import.

I think the latter is more likely, but nothing is set in stone yet. The 
issue in the spec suggests "perhaps functional notation at the end of 
the ‘@import’ rule."

Currently in @import the media queries extend until the end of the 
at-rule. (A top-level ';') So we would need some delimiter to mark where 
media queries end and where support-testing starts. Or maybe integrate 
support-testing *inside* media queries?


> (For what it's worth, the LINK syntax to reference CSS files from HTML
> should also be extended for @supports-like queries, but I believe this
> is off-topic in this mailing list.)

HTML5 defines this 'media' attribute as media queries, and MQs are 
on-topic on this list. It might be a bad idea, but if we integrate 
support-testing in a future level of media queries, that will 
automatically apply to <link rel=stylesheet> elements and any other 
usage of MQs.


Cheers,
-- 
Simon Sapin
Received on Thursday, 11 October 2012 06:58:20 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:01 GMT