Re: why not MediaQueryList.onchange

On Fri, 08 Aug 2014 19:45:36 +0200, Tab Atkins Jr. <jackalmage@gmail.com>  
wrote:

> 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.

I'm not convinced it would make any difference in performance.

> 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.

Yeah.

-- 
Simon Pieters
Opera Software

Received on Saturday, 9 August 2014 19:57:03 UTC