<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23188</bug_id>
          
          <creation_ts>2013-09-09 16:33:51 +0000</creation_ts>
          <short_desc>Validator / test suite CSS media query bugs</short_desc>
          <delta_ts>2013-09-16 21:35:49 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML Checker</product>
          <component>General</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Rogers">mark.rogers</reporter>
          <assigned_to name="Michael[tm] Smith">mike+validator</assigned_to>
          <cc>mike</cc>
          
          <qa_contact name="qa-dev tracking">www-validator-cvs</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>93163</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Rogers">mark.rogers</who>
    <bug_when>2013-09-09 16:33:51 +0000</bug_when>
    <thetext>There are a couple of test suite problems related to white space in CSS media queries:

1) Validator.nu (and media-queries/018-novalid.html) expects media=&apos;screen and (device-aspect-ratio: 16 / 9)&apos; to be a failure due to whitespace in &quot;16 / 9&quot;. My reading of the spec is that whitespace is allowed in the ratio:
http://www.w3.org/TR/css3-mediaqueries/#aspect-ratio
(The media query from the test failure passes in jigsaw.w3.org)

2) Validator.nu (and media-queries/012-novalid.html) expects &quot;screen and (min-width: 400px)and (max-width: 600px)&quot; to fail due to missing whitespace before the &apos;and&apos;. My reading of the spec is that whitespace (the S* production) is optional:
http://www.w3.org/TR/css3-mediaqueries/#syntax
(The media query from the test failure passes in jigsaw.w3.org)

PS Have a few more like this - I&apos;ll probably report them over the next few weeks.

Best Regards
Mark

Mark Rogers - mark.rogers@powermapper.com
PowerMapper Software Ltd - www.powermapper.com 
Registered in Scotland No 362274 Quartermile 2 Edinburgh EH3 9GL</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93186</commentid>
    <comment_count>1</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2013-09-10 07:17:27 +0000</bug_when>
    <thetext>(In reply to Mark Rogers from comment #0)
&gt; There are a couple of test suite problems related to white space in CSS
&gt; media queries:
&gt; 
&gt; 1) Validator.nu (and media-queries/018-novalid.html) expects media=&apos;screen
&gt; and (device-aspect-ratio: 16 / 9)&apos; to be a failure due to whitespace in &quot;16
&gt; / 9&quot;. My reading of the spec is that whitespace is allowed in the ratio:
&gt; http://www.w3.org/TR/css3-mediaqueries/#aspect-ratio
&gt; (The media query from the test failure passes in jigsaw.w3.org)

Yeah, the current spec does say:

http://www.w3.org/TR/css3-mediaqueries/#values
&quot;The &lt;ratio&gt; value is a positive (not zero or negative) &lt;integer&gt; followed by optional whitespace, followed by a solidus (‘/’), followed by optional whitespace, followed by a positive &lt;integer&gt;.&quot;

So we&apos;ll need to update the media-queries checker in the validator to match that.

At the time the media-queries checker was implemented in the validator, the spec said, &quot;The value consists of two positive integers separated by a ‘/’.&quot; (nothing about whitespace).

But that was a long time ago:
http://www.w3.org/TR/2007/CR-css3-mediaqueries-20070606/#device-aspect-ratio

So it&apos;s likely there are other places where we&apos;re not up to date with the current spec.

Anyway, I&apos;ll fix the &lt;ratio&gt; case as soon as possible.


&gt; 2) Validator.nu (and media-queries/012-novalid.html) expects &quot;screen and
&gt; (min-width: 400px)and (max-width: 600px)&quot; to fail due to missing whitespace
&gt; before the &apos;and&apos;. My reading of the spec is that whitespace (the S*
&gt; production) is optional:
&gt; http://www.w3.org/TR/css3-mediaqueries/#syntax

Yeah, agreed. The BNF there says:

media_query
 : [ONLY | NOT]? S* media_type S* [ AND S* expression ]*
 | expression [ AND S* expression ]*
 ;
expression
 : &apos;(&apos; S* media_feature S* [ &apos;:&apos; S* expr ]? &apos;)&apos; S*
 ;

...which seems to clearly define the whitespace before the &quot;and&quot; as optional everywhere, as well as the whitespace after the &quot;and&quot; (right?).

&gt; (The media query from the test failure passes in jigsaw.w3.org)

Yeah. Though I note that the following doesn&apos;t pass on jigsaw.w3.org:

  @media screen and (min-width: 400px) and(max-width: 600px) {}

...I guess because jigsaw expects whitespace after the &quot;and&quot; there.
 
&gt; PS Have a few more like this - I&apos;ll probably report them over the next few
&gt; weeks.

Please do keep &apos;em coming. In the mean time, I&apos;ll try to fix these two.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93194</commentid>
    <comment_count>2</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2013-09-10 11:17:03 +0000</bug_when>
    <thetext>(In reply to Michael[tm] Smith from comment #1)
&gt; (In reply to Mark Rogers from comment #0)
&gt; &gt; 2) Validator.nu (and media-queries/012-novalid.html) expects &quot;screen and
&gt; &gt; (min-width: 400px)and (max-width: 600px)&quot; to fail due to missing whitespace
&gt; &gt; before the &apos;and&apos;. My reading of the spec is that whitespace (the S*
&gt; &gt; production) is optional:
&gt; &gt; http://www.w3.org/TR/css3-mediaqueries/#syntax
&gt; 
&gt; Yeah, agreed. The BNF there says:
&gt; 
&gt; media_query
&gt;  : [ONLY | NOT]? S* media_type S* [ AND S* expression ]*
&gt;  | expression [ AND S* expression ]*
&gt;  ;
&gt; expression
&gt;  : &apos;(&apos; S* media_feature S* [ &apos;:&apos; S* expr ]? &apos;)&apos; S*
&gt;  ;

Actually, I&apos;m wrong. We should pretty much never use any documents in http://www.w3.org/TR/ as the latest authority for requirements. The TR drafts for most Web-platform technologies are almost always out of date. In this case it&apos;s been pointed out to me that the latest media-queries spec is at http://dev.w3.org/csswg/mediaqueries4/

And if you look at http://dev.w3.org/csswg/mediaqueries4/#syntax you&apos;ll see that says:

media_query
 : [ONLY S+ | NOT S+]? media_type [ S+ AND S+ expression ]* S*
 | expression [ S+ AND S+ expression ]* S*
 ;

So the whitespace around &quot;and&quot; is now (again) required, both before &quot;and&quot; and after it.

So the existing validator behavior (still) conforms to the latest media-queries spec for this case, and the media-queries/012-novalid.html document is in the test suite is till not valid.


&gt; 
&gt; ...which seems to clearly define the whitespace before the &quot;and&quot; as optional
&gt; everywhere, as well as the whitespace after the &quot;and&quot; (right?).
&gt; 
&gt; &gt; (The media query from the test failure passes in jigsaw.w3.org)
&gt; 
&gt; Yeah. Though I note that the following doesn&apos;t pass on jigsaw.w3.org:
&gt; 
&gt;   @media screen and (min-width: 400px) and(max-width: 600px) {}
&gt; 
&gt; ...I guess because jigsaw expects whitespace after the &quot;and&quot; there.
&gt;  
&gt; &gt; PS Have a few more like this - I&apos;ll probably report them over the next few
&gt; &gt; weeks.
&gt; 
&gt; Please do keep &apos;em coming. In the mean time, I&apos;ll try to fix these two.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93195</commentid>
    <comment_count>3</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2013-09-10 11:21:13 +0000</bug_when>
    <thetext>(In reply to Michael[tm] Smith from comment #2)
&gt; And if you look at http://dev.w3.org/csswg/mediaqueries4/#syntax you&apos;ll see
&gt; the whitespace around &quot;and&quot; is now (again) required, both before &quot;and&quot;
&gt; and after it.

See also http://www.w3.org/Style/2012/REC-mediaqueries-20120619-errata.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93455</commentid>
    <comment_count>4</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2013-09-16 21:35:49 +0000</bug_when>
    <thetext>(In reply to Mark Rogers from comment #0)
&gt; There are a couple of test suite problems related to white space in CSS
&gt; media queries:
&gt; 
&gt; 1) Validator.nu (and media-queries/018-novalid.html) expects media=&apos;screen
&gt; and (device-aspect-ratio: 16 / 9)&apos; to be a failure due to whitespace in &quot;16
&gt; / 9&quot;. My reading of the spec is that whitespace is allowed in the ratio:

I&apos;ve fixed that now in the code and pushed the change to the W3C validator.

&gt; 2) Validator.nu (and media-queries/012-novalid.html) expects &quot;screen and
&gt; (min-width: 400px)and (max-width: 600px)&quot; to fail due to missing whitespace
&gt; before the &apos;and&apos;. My reading of the spec is that whitespace (the S*
&gt; production) is optional:

As I noted in earlier comments, the latest MQ spec once again makes that whitespace required, not optional. So I&apos;m going ahead and closing this bug. To report other issues with MQ checking in validator, please raise other bugs.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>