Re: [cssom-view] comments on StyleMedia interface

On Wed, 18 Aug 2010 00:29:15 +0200, Simon Fraser <smfr@me.com> wrote:
> On Aug 17, 2010, at 2:56 PM, Anne van Kesteren wrote:
>> 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.

Ah, that argument name was not really meant to mean anything. I guess it  
depends on whether matchMedia accepts a single media query or a list of  
media queries. If indeed a single I agree that query makes more sense, but  
then it should probably also be matchMediaQuery().

(At which point I also wonder if maybe we should then just put it directly  
on the Window object and get rid of styleMedia and styleMedia.type.)


>>  // 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?

This matches (harhar) e.g. Element.matchesSelector() but isMatched or back  
to result is fine with me as well.


>>  // 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?

Given what we do elsewhere I suppose the same object would be better.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 17 August 2010 22:45:43 UTC