Re: [cssom-view] addMediumListener / removeMediumListener

On Tue, 25 May 2010 18:05:39 +0200, Luiz Agostini  
<luiz.agostini@openbossa.org> wrote:
> 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?

The text talks about "parse a media query" which is quite clearly defined  
in:

http://dev.w3.org/csswg/cssom/#parse-a-media-query

I.e. it only accepts a single media query.


> 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);
> }
>
> 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.

Fair enough. I've made it BooleanCallback and added a closure example (the  
corrected one). And also a simple usage example.


> 3 - Is the order in which the callbacks must be called specified?

Yes, there's an ordered list which is only appended to. I've added the  
word "ordered" to make this more clear :-)


Thanks a lot for giving feedback so quickly!


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

Received on Wednesday, 26 May 2010 09:26:28 UTC