Re: [cssom-view] comments on StyleMedia interface

On Aug 17, 2010, at 2:56 PM, Anne van Kesteren wrote:

> On Tue, 17 Aug 2010 23:38:51 +0200, Simon Fraser <smfr@me.com> wrote:
>> I like David's proposal. It's cleaner (at the expense of adding a new class).
> 
> Alright, great. So are we going with the following then:
> 
> interface StyleMedia {
>  readonly attribute DOMString type;
>  MediaQuery matchMedia(query);
> };
> 
> interface MediaQuery {
>  // The serialized form of the query list used to create this object.
>  // (Anne: renamed query to media.)
>  readonly attribute DOMString media;

I think 'query' was better, since it matches the parameter name to matchMedia() above. Media could be misinterpreted as a list of media types.

>  // The current result of the query
>  // (Anne: renamed result to matches.)
>  readonly attribute boolean matches;

This could be misinterpreted as a list of matches. Maybe isMatched?

>  // add and remove listeners (should it ensure uniqueness or not?)
>  void addListener(MediaQueryChangeListener listener);
>  void removeListener(MediaQueryChangeListener listener);
> };

Does calling matchMedia() multiple times with the same query return a new object every time, or a reference to an existing object?

Simon

Received on Tuesday, 17 August 2010 22:29:48 UTC