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

Re: Extending CSSOM Views matchMedium with callback

From: Kenneth Christiansen <kenneth.christiansen@openbossa.org>
Date: Mon, 10 May 2010 13:34:15 -0300
Message-ID: <AANLkTimqNUMCHs2OW0xU6Jb4XQewUnn6KpTbwj1NE7Ed@mail.gmail.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: Luiz Agostini <luiz.agostini@openbossa.org>, public-webapps@w3.org, www-style@w3.org
I wonder if it makes sense to have another method for adding the
listener instead of "abusing" the already existing matchMedium. For
instance, calling matchMedium is going to evaluate the expression,
which is not really necessary.

Kenneth

On Mon, May 10, 2010 at 12:48 PM, L. David Baron <dbaron@dbaron.org> wrote:
> 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/
>
>



-- 
Kenneth Rohde Christiansen
Technical Lead / Senior Software Engineer
Qt Labs Americas, Nokia Technology Institute, INdT
Phone  +55 81 8895 6002 / E-mail kenneth.christiansen at openbossa.org
Received on Monday, 10 May 2010 16:34:51 GMT

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