Re: why not MediaQueryList.onchange

On Fri, 06 Jun 2014 11:20:34 +0200, Simon Pieters <simonp@opera.com> wrote:

> On Mon, 19 May 2014 14:13:48 +0200, Tab Atkins Jr.  
> <jackalmage@gmail.com> wrote:
>
>> * alias the existing addListener(...) to addEventListener("change",
>> ...); same with removeListener()
>
> I looked into changing this in the spec and noticed that this would  
> change the argument of the callback from the MediaQueryList object to  
> the event, which is potentially a Web compat problem.
>
> For instance http://www.cafepress.ca/ uses:
>
>  cafepress.globalHeader.matchMedia(570, function(mq){
>   if(!gtmLoaded) {
>    if(!mq || !mq.matches) {
>
> This can be solved by minting a new event interface that has .media and  
> .matches.
>
> It would still break if a page uses e.g. removeListener on the  
> callback's argument, or does other things like type-check the argument,  
> but maybe that's not common enough to worry about.

Fixed: https://dvcs.w3.org/hg/csswg/rev/ce11bd9d0293

-- 
Simon Pieters
Opera Software

Received on Friday, 6 June 2014 10:38:37 UTC