Re: [CSSOM View] MediaQueryList as EventTarget

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 UTC