W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2010

Re: Extending CSSOM Views matchMedium with callback

From: L. David Baron <dbaron@dbaron.org>
Date: Mon, 10 May 2010 08:48:09 -0700
To: Luiz Agostini <luiz.agostini@openbossa.org>
Cc: public-webapps@w3.org, www-style@w3.org
Message-ID: <20100510154809.GA16693@pickering.dbaron.org>
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?

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Monday, 10 May 2010 15:48:43 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:38 GMT