W3C home > Mailing lists > Public > www-style@w3.org > May 2010

Extending CSSOM Views matchMedium with callback

From: Luiz Agostini <luiz.agostini@openbossa.org>
Date: Fri, 7 May 2010 15:31:46 -0300
Message-ID: <l2qc80c222e1005071131xf5a90104ub715fb73bc915424@mail.gmail.com>
To: public-webapps@w3.org, www-style@w3.org
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

    interface MediaChangeListener {
        void mediaChanged(in boolean queryResult);

    interface StyleMedia {
        readonly attribute DOMString type;
        boolean matchMedium(in DOMString mediaquery, in MediaChangeListener

If listener is supplied to the  matchMedium call then its mediaChanged method
will be called every time when then result of the expression given in
'mediaquery' changes. mediaChanged parameter queryResult receives the
current value (true/false) of the corresponding mediaquery.

The idea and actual implementation has already gone through some initial
feedback rounds in WebKit Bugzilla


[1] http://lists.w3.org/Archives/Public/public-webapps/2010AprJun/0071.html
Received on Monday, 10 May 2010 13:48:13 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:34 UTC