Re: Extending CSSOM Views matchMedium with callback

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 UTC