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

Re: why not MediaQueryList.onchange

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 8 Aug 2014 10:45:36 -0700
Message-ID: <CAAWBYDBOzyegiLTb9J4+Sq8+TYztSPOxSsUvhOGpbCzEW0F=eg@mail.gmail.com>
To: Jonathan Fielding <hello@jonathanfielding.com>
Cc: Simon Pieters <simonp@opera.com>, Jochen Eisinger <eisinger@google.com>, www-style list <www-style@w3.org>
On Fri, Aug 8, 2014 at 10:36 AM, Jonathan Fielding
<hello@jonathanfielding.com> wrote:
> By baking this right into the browser, the browser controls the performance
> optimisation, so in the case of a resize event only for large viewports, on
> smaller viewports we won’t have any resize methods firing.

This seems like a bit of a layering violation.  Why would 'resize'
events be the only thing you'd want to apply this kind of filtering
to?  I can easily see arguments for practically any event being
limited by an MQ test.

You can do this yourself quite easily, by adding the listener on match
and removing it on unmatch, using code nearly identical to what you
posted in your previous message.  This gives you the flexibility to
use any event, on any object, using any arbitrary additional
constraints you wish.

~TJ
Received on Friday, 8 August 2014 17:46:23 UTC

This archive was generated by hypermail 2.3.1 : Friday, 8 August 2014 17:46:23 UTC