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 15:29:15 -0700
Cc: www-style@w3.org, "L. David Baron" <dbaron@dbaron.org>
Message-id: <E8E67168-874B-4705-9495-7E842462A4E9@me.com>
To: Anne van Kesteren <annevk@opera.com>
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 GMT

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