Re: Extending CSSOM Views matchMedium with callback

On Friday 2010-05-07 15:31 -0300, Luiz Agostini wrote:
> The consensus on the W3C Extending CSSOM Views matchMedium with
> callbacks [1] mailing list was that instead of adding individual DOM
> events for changes to media features, we should instead make it
> possible to get notified when a user defined media query has changed.
> The idea was making it possible to supply a JavaScript function to the
> styleMedia.matchMedium(...) function.
> As no exact IDL was proposed, I came up with one myself which I think fits the
> use-case, and implemented the feature for WebKit.
> The result of my work became the following IDL, for which I would like
> comments/feedback:
>     interface MediaChangeListener {
>         void mediaChanged(in boolean queryResult);
>     };
>     interface StyleMedia {
>         readonly attribute DOMString type;
>         boolean matchMedium(in DOMString mediaquery, in MediaChangeListener
> listener);
>     };

This seems reasonable to me, although I wonder if it's worth passing
a little more information to the listener, such as (a) the original
query or (b) the window.  Would that be useful to authors, or are
they comfortable stuffing whatever is necessary in a closure?


L. David Baron                       
Mozilla Corporation             

Received on Monday, 10 May 2010 15:48:43 UTC