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

Re: [cssom-view] addMediumListener / removeMediumListener

From: Luiz Agostini <luiz.agostini@openbossa.org>
Date: Tue, 25 May 2010 13:13:18 -0300
Message-ID: <AANLkTikIieuEpv6tVd3lbtBuqKk8Y7wbQ6pEUWnKadkm@mail.gmail.com>
To: Anne van Kesteren <annevk@opera.com>
Cc: www-style@w3.org, marcosc@opera.com
2010/5/25 Luiz Agostini <luiz.agostini@openbossa.org>

> Hi,
>
> I have some questions:
>
> 1 - The text refers to media query. Is it a media_query or a
> media_query_list as defined in
> http://www.w3.org/TR/css3-mediaqueries/#syntax? I assume it is about a
> media_query_list. The serialization rules for a list of media queries do not
> mention any sorting of the queries in the list and thus is not good for
> comparison because it would then lead to "(color) and (min-width: 100px)" !=
> (min-width: 100px) and (color)" for example. Should serialization rules for
> a list of media queries change?
>
> 2 - Is mediaText really needed as parameter of MediaQueryCallbacks? Being a
> serialization of the media query it may be different of the original query
> and user would not have an easy way to recognize it. In other hand it may be
> very easy to provide this kind of information to callbacks using Javascript
> closures. For example:
>
> function mediumCallback(query, value)
> {
>     alert(query + " = " + value);
> }
>
> function addMediumListener(query)
> {
>     window.styleMedia.addMediumListener(query, mediumCallback);
>

Correcting:
    window.styleMedia.addMediumListener(query, function(value)
{ mediumCallback(query, value); } );
Sorry for this mistake.

}
>
> addMediumListener("tv and (color)");
>
>  Any kind of information may be supplied to the callbacks this way and the
> media query, specially the serialized media query,  may not necessarily the
> most useful information in all situations.
>
> 3 - Is the order in which the callbacks must be called specified?
>
> br,
> Luiz
>
> 2010/5/25 Anne van Kesteren <annevk@opera.com>
>
> Taking no answer to my endorsement of the proposal of David Baron as a
>> tentative yes I added addMediumListener and removeMediumListener to the
>> draft of CSSOM View. It was a little bit more complex than I thought so I'd
>> appreciate it if people gave it a good look for errors. They're part of the
>> StyleMedia interface.
>>
>> http://dev.w3.org/csswg/cssom-view/#the-stylemedia-interface
>>
>> I re-used terminology as much as possible. The only exception is that I
>> used the interface prefix MediaQuery rather than Media (as would be logical
>> given MediaList) to prevent potential future clashes with the media elements
>> in HTML.
>>
>>
>> --
>> Anne van Kesteren
>> http://annevankesteren.nl/
>>
>>
>
Received on Tuesday, 25 May 2010 16:13:51 GMT

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