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

Re: why not MediaQueryList.onchange

From: Simon Pieters <simonp@opera.com>
Date: Fri, 06 Jun 2014 12:38:17 +0200
To: "Jochen Eisinger" <eisinger@google.com>, "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "www-style list" <www-style@w3.org>
Message-ID: <op.xg03t3ppidj3kv@simons-mbp>
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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:22 UTC