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
comments/feedback:

    interface MediaChangeListener {
        void mediaChanged(in boolean queryResult);
    };

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

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
(https://bugs.webkit.org/show_bug.cgi?id=37205)

Luiz

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

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