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

Re: [cssom-view] comments on StyleMedia interface

From: Simon Fraser <smfr@me.com>
Date: Tue, 17 Aug 2010 14:38:51 -0700
Cc: www-style@w3.org, "L. David Baron" <dbaron@dbaron.org>
Message-id: <47F4A06A-EF08-41C6-BD85-AAE46ECF9DAA@me.com>
To: Anne van Kesteren <annevk@opera.com>
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 GMT

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