Re: why not MediaQueryList.onchange

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