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

Re: [css3-mediaqueries][cssom] Empty media queries in stylesheets and the DOM

From: Anne van Kesteren <annevk@opera.com>
Date: Wed, 12 May 2010 11:30:04 +0200
To: "Sylvain Galineau" <sylvaing@microsoft.com>, "L. David Baron" <dbaron@dbaron.org>
Cc: "www-style list" <www-style@w3.org>
Message-ID: <op.vck50ed464w2qv@annevk-t60>
On Wed, 28 Apr 2010 19:50:53 +0200, L. David Baron <dbaron@dbaron.org>  
> On Thursday 2010-04-15 00:49 +0000, Sylvain Galineau wrote:
>> Things get more confusing at the DOM level.
>> If one specifies an @media all {...} rule and then removes the
>> 'all' medium using MediaList.deleteMedium()[4], Firefox then
>> returns 'not all' for MediaList.mediaText.
>> Consistent with this media query value, the content of the @media
>> rule no longer applies and the relevant elements' style is updated
>> accordingly.
> This is related to our handling of the combination of these two
> statements in section 3.1 of media queries
> http://www.w3.org/TR/2009/CR-css3-mediaqueries-20090915/#error-handling :
> Statement 1:
>   # * Unknown media features. User agents are to ignore a media
>   #   query when one of the specified media features is unknown.
>   # [...]
>   # * Unknown media feature values. As with unknown media features,
>   #   user agents are to ignore a media query when one of the
>   #   specified media feature values is unknown.
> Statement 2:
>   # When all media queries in a media query list are ignored it is
>   # the same as if "not all" was specified.
> I implemented this by recording in a media query list whether it had
> any queries in it (ignored or not), which leads to the bad side
> effect that you mention: once a media query is non-empty, it becomes
> impossible to empty it back to being equivalent to 'all'.
> I think the object model handling here would be much more sensible
> if statement 2 were changed to say that *each* media query in a
> media query list that is ignored is treated as 'not all', and
> replaced in the object model by 'not all'.
> Then the emptiness check for media query lists can be made using
> only information that is represented in the object model rather than
> requiring hidden information (whether any media queries were
> ignored) that is not in the object model.

That seems like a sensible change. So

   screen and (foobar), print and (foobar)

turns into

   not all, not all

Would appendMedium() still "ignore" the call if the parsed media query is  
ignored, as currently defined? I guess it might make more sense if it  
appends "not all" in that case. When you serialize a list of media queries  
should it return "all" if the list is empty? Or just the empty string?

Anne van Kesteren
Received on Wednesday, 12 May 2010 09:31:01 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:35 UTC