Re: [cssom-view] comments on StyleMedia interface

On Aug 12, 2010, at 3:24 AM, Anne van Kesteren wrote:

> On Sun, 18 Jul 2010 01:18:55 +0200, L. David Baron <dbaron@dbaron.org> wrote:
> 
>> I can think of an alternative that would fix both of these problems,
>> although I'm not sure if I like it any better than what's now in the
>> spec.  But, in case anyone else likes it, the idea is to, in place
>> of addMediaListener, removeMediaListener, and BooleanCallback, add a
>> method to StyleMedia that takes a string and returns a new
>> MediaQuery object, implementing:
>>  interface MediaQuery {
>>    // The serialized form of the query list used to create this object.
>>    readonly attribute DOMString query;
>>    // The current result of the query.
>>    readonly attribute boolean result;
>>    // add and remove listeners (should it ensure uniqueness or not?)
>>    void addListener(MediaQueryChangeListener listener);
>>    void removeListener(MediaQueryChangeListener listener);
>>  };
>>  [Callback=FunctionOnly, NoInterfaceObject]
>>  interface MediaQueryChangeListener {
>>    void queryChanged(MediaQuery query);
>>  };
> 
> I left in what we have now since nobody seems to be jumping for this :-) Though it's quite a neat API I have to say.

I like David's proposal. It's cleaner (at the expense of adding a new class).

Simon

Received on Tuesday, 17 August 2010 21:39:40 UTC