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

Re: Proposal: Detecting JavaScript with Media Queries

From: Jeffrey Way <jeffrey@envato.com>
Date: Tue, 3 Jan 2012 19:10:47 -0500
Message-ID: <CACmxQyV8h7TMri=RR57cd5ej2hKNgdy9Vfku7GmhRDbbJREaYQ@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "Nicholas C. Zakas" <standards@nczconsulting.com>, www-style@w3.org
For simple projects, there's a lot to be said for the readability of
sticking with class-based detection, and doing:

.someJSDependentTickerThingy { ... }
.no-js .someJSDependentTickerThingy { display: none; }

as opposed to either declaring multiple media query sections, or
abstracting all of it to the bottom...which can sometimes be confusing.
But, for heavier applications, this would be a huge help. +1.

Jeffrey

On Tue, Jan 3, 2012 at 5:51 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Tue, Jan 3, 2012 at 2:43 PM, Nicholas C. Zakas
> <standards@nczconsulting.com> wrote:
> > On 1/3/2012 1:03 PM, Tab Atkins Jr. wrote:
> >>
> >> On Tue, Jan 3, 2012 at 12:47 PM, Nicholas C. Zakas
> >> <standards@nczconsulting.com>  wrote:
> >>>
> >>> I'd like to propose adding "script" support for media queries, so you
> can
> >>> write queries such as:
> >>>
> >>> @media screen and (script) {
> >>> ...
> >>> }
> >>>
> >>> @media screen and not (script) {
> >>> ...
> >>> }
> >>>
> >>> This way, we'd never again have to use of these silly JS-based hacks
> just
> >>> to change the appearance when JavaScript is enabled or disabled.
> >>>
> >>> Thoughts?
> >>
> >> Sounds pretty good.  The JS-based hacks are simple and easy, but
> >> having this be a media query lets us keep our selectors simpler, and
> >> lets the browser avoid attempting to match the other set of rules at
> >> all.
> >>
> >> ~TJ
> >
> > Yup, that was exactly my goal. So...how can we make this happen? :)
>
> I believe MQ is now under the purview of Florian and Sylvain, since
> Anne left the group.  So they just need to put it in the idea bucket
> for the next revision.
>
> ~TJ
>
>
Received on Wednesday, 4 January 2012 00:11:14 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:48 GMT