W3C home > Mailing lists > Public > www-style@w3.org > May 2013

Re: [mediaqueries] User-defined Media Queries?

From: Florian Rivoal <florian@rivoal.net>
Date: Fri, 31 May 2013 22:09:19 +0200
To: "Yehuda Katz" <wycats@gmail.com>, "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "www-style list" <www-style@w3.org>
Message-ID: <op.wxysxtqlf5de51@riboaru-nashiosamus-imac-2.local>
On Fri, 31 May 2013 20:21:16 +0200, Tab Atkins Jr. <jackalmage@gmail.com>  
wrote:

> On Fri, May 31, 2013 at 11:17 AM, Yehuda Katz <wycats@gmail.com> wrote:
>> What about just:
>>
>>> <html>
>>>   <script>
>>>     if (window.outerWidth >= 600)
>>>       document.css.media.huge = true;
>>>     }
>>>   </script>
>>>   <style>
>>>     @media ("huge") {
>>
>>>       .facet_sidebar {
>>>         display: none;
>>>       }
>>>     }
>>>   </style>
>>> </html>
>
> Hmm, using bare strings as the media query name is interesting.  It's
> definitely unambiguous and non-colliding, and means that authors can
> give whatever they want as the name without having to worry about
> escaping.  Plus, nice and short.  +1.

And as the syntax error recovery in media queries was well though out,
this works fine in old browsers.

@media (min-width:300px), ("huge") { ... }

The custom query never matches, but only the custom part is discarded,
not the whole @media rule. Most syntax extensions we could consider
for media queries have this property, so this isn't unique about
this specific proposal, but it is always a good thing to have.

I need to think about this some more, but this is certainly interesting.

  - Florian
Received on Friday, 31 May 2013 20:09:42 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:30 UTC