W3C home > Mailing lists > Public > www-style@w3.org > April 2014

Re: [mediaqueries] Custom Media Queries defined inside @media

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 15 Apr 2014 10:20:37 -0700
Message-ID: <CAAWBYDBT8tFTNJokOJScOExk+bsEyyFSaJ3d_bBrEa4NtCdOQQ@mail.gmail.com>
To: Simon Sapin <simon.sapin@exyr.org>
Cc: www-style list <www-style@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
On Tue, Apr 15, 2014 at 5:27 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
> On 15/04/2014 04:09, Boris Zbarsky wrote:
>> On 4/14/14 11:00 PM, Cameron McCormack wrote:
>>> That seems like a reasonable thing to want to do.  Can we define that
>>> variables in @media rules are resolved using the computed style of the
>>> root element?
>>
>> How does that handle rules in the @media rule that set the variable on
>> the root?
>
> There is a proposal for custom Media Queries (similar to custom properties
> but in a different namespace)
>
> http://dev.w3.org/csswg/mediaqueries4/#custom-mq
>
> But Boris’s point still stands. Can custom MQs be declared inside
> conditional rules? In stylesheets that are imported or linked conditionally
> with a MQ? What is their scope? Do they apply to @media rules in other
> stylesheets? To non-CSS MQs in the document? How are any circular definition
> resolved?

Their scope is global, like all other names that CSS rules define, so
they apply to all stylesheets.

I'll have to work out how to address the "@custom-media inside of
@media" thing.  First thought is just to require they be top-level,
but that doesn't help, since you can @import them conditionally as
well.  I'll probably need cycle detection - a custom MQ implicitly
depends on any custom MQs used in its current context.

Circular definitions are similar.  I'd like to avoid cycle detection
if possible, and just disallow @custom-media from containing custom
MQs, but since I'll probably need it for @custom-media-in-@media
anyway, it's probably not worth adding that restriction.

~TJ
Received on Tuesday, 15 April 2014 17:21:24 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:21 UTC