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

Re: [CSSOM View] MediaQueryList as EventTarget

From: L. David Baron <dbaron@dbaron.org>
Date: Thu, 14 Jun 2012 20:39:42 -0700
To: Dean Jackson <dino@apple.com>
Cc: www-style list <www-style@w3.org>
Message-ID: <20120615033942.GA27405@crum.dbaron.org>
On Thursday 2012-06-14 18:25 -0700, Dean Jackson wrote:
> The MediaQueryList interface has addListener and removeListener
> methods, that each take a MediaQueryListListener (which is a
> pretty cool name when you think about it).
> 
> MediaQueryListListener has a single handleChange() method.

Which is marked [Callback] so that the name should basically never
show up.

> Is there a good reason why MediaQueryList isn't just an
> EventTarget? It makes more sense to me, and would allow you to
> have a single controller object to implement handleEvent for all
> your code. As it currently stands, it is a weird handleChange
> method.

I seem to recall a previous discussion of replacing these
notifications with events, but I think it was started by a
suggestion that the window or the document be the target, which
makes this rather more difficult.  Off the top of my head, I don't
see a reason that the MediaQueryList couldn't be the target other
than compatibility with the existing implementations (which I think
include quite a few major browsers, so compatibility may be a real
issue).

(Is your assumption that the events wouldn't bubble anywhere?)

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂
Received on Friday, 15 June 2012 03:40:08 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:55 GMT