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

Re: @import and @supports

From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date: Thu, 11 Oct 2012 09:23:53 +0200
Message-ID: <CAOxFTczZZXVAT0paPdKKnhQJNY+FJ2QMPysRtzbmVj75BdOh6Q@mail.gmail.com>
To: Simon Sapin <simon.sapin@kozea.fr>
Cc: WWW Style <www-style@w3.org>
Hello Simon,

thanks a lot for your reply.

On Thu, Oct 11, 2012 at 8:57 AM, Simon Sapin <simon.sapin@kozea.fr> wrote:
> Le 11/10/2012 08:39, Giuseppe Bilotta a écrit :
>> 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.
>
> This is a know issue in the css3-conditional spec. (Noted as Issue 1.)

Oh, I just noticed. I was looking at the editor's draft and couldn't
find a reference to this issue there. My fault.

> 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.

It's a pity, but I understand the importance of priorities.

>> 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?

>From a naive point of view like mine, a simple @ would be a proper
separator, in the sense that when an @ is encountered it marks the
start of an at-rule conditional; this would allow extending the syntax
beyond @supports; for example:

@import url("index-columns.css") screen @supports (columns: auto)
@document regexp("*/index.html")

But of course, I have no idea if this even makes sense in the scope of
the CSS syntax.

>> (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.

Good point, thanks.

Cheers,

-- 
Giuseppe "Oblomov" Bilotta
Received on Thursday, 11 October 2012 07:24:44 GMT

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