<?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>2920</bug_id>
          
          <creation_ts>2006-02-22 22:35:15 +0000</creation_ts>
          <short_desc>Several invalid forms using @charset  passed as valid</short_desc>
          <delta_ts>2008-03-08 00:02:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSSValidator</product>
          <component>CSS 2.0</component>
          <version>CSS Validator</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>http 404 Fichier non trouv</status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="CecilWard">cecil</reporter>
          <assigned_to name="This bug has no owner yet - up for the taking">dave.null</assigned_to>
          
          
          <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>8390</commentid>
    <comment_count>0</comment_count>
    <who name="CecilWard">cecil</who>
    <bug_when>2006-02-22 22:35:15 +0000</bug_when>
    <thetext>The CSS validator passes the following with no error,

Test case 1.
    @charset&quot;utf-8&quot;;

(spec requires a space before open quotes)


Test case 2.
    @charset              &quot;utf-8&quot;;

(spec requires exactly 1 space before opening double quotes)


Test case 3.
    @charset
    &quot;utf-8&quot;;

(newline instead of space)

Test case 4.
    @charset/**/&quot;utf-8&quot;;

Test case 5.
    @charset &quot;utf-8&quot; ;

(illegal space before semicolon)

Test case 6.
    @charset &quot;utf-8&quot;
    ;

(illegal newline before semicolon)

Test case 7:
    /**/@charset &quot;utf-8&quot;;


Regards,

Cecil Ward.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>8395</commentid>
    <comment_count>1</comment_count>
    <who name="Bj">bjoern</who>
    <bug_when>2006-02-23 04:52:12 +0000</bug_when>
    <thetext>I assume with &quot;the spec&quot; you mean the CSS 2.1 Working Draft? CSS 2.1 changed 
the rules for this and the CSS Validator predates those draft rules...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9389</commentid>
    <comment_count>2</comment_count>
    <who name="CecilWard">cecil</who>
    <bug_when>2006-04-21 15:40:55 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; I assume with &quot;the spec&quot; you mean the CSS 2.1 Working Draft? CSS 2.1 changed 
&gt; the rules for this and the CSS Validator predates those draft rules...

Good point. Indeed, I was looking at CSS 2.1. But my point stands, because even if you explicitly set the validator to use CSS 2.1, it passes all the above. (I just rechecked.) So it basically can not validate against the 2.1 grammar.

As for CSS2.0 (if you like0, I would need to look at the test cases again with CSS2.0 eyes. But presumably having something that is valid only against CSS2.0 but is not actually going to work in (any? some?) browsers isn&apos;t useful. Maybe the validator should issue a warning about certain highly questionable forms of css if the user explicitly selects CSS2.0.

A further point. If the user has not specified a version of CSS, and the various grammars are in conflict, in the sense that what the user has entered is legal in one version of CSS but illegal in another, then maybe the best thing to do would be to warn the user rather than just saying &quot;valid!&quot; which is meaningless and sort-of dangerous.

Suggestion: In the case where the user does not pick as CSS version one possible improvement would be to parse the user&apos;s CSS fragment multiple times against the various grammars and if there are both passes and fails, tell the user the details. Warnings about lack of backwards- or forwards capability would be a valuable added benefit of using the validator.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9393</commentid>
    <comment_count>3</comment_count>
    <who name="CecilWard">cecil</who>
    <bug_when>2006-04-21 17:23:18 +0000</bug_when>
    <thetext>Having taken another look, from a CSS2.0 standpoint

CSS 2 section 4.4 states

&quot;@charset rule [...] must appear at the very start of the document, not preceded by any characters&quot;.

So by this paragraph, the validator should report an error in the case where some whitespace and/or a comment, say, precedes the @charset. This is a fault. Because of the restrictive specification of @charset, the CSS validator is not at liberty to pre-strip all comments or strip whitespace in an initial phase before doing futher syntactical analysis. Looking at the output displayed in the case of an error suggests that it may pre-strip comments.

As for the CSS2 documents, the restriction expressed in that English sentence is not reflected in the example formal grammar in the CSS2 appendix D, which is too lax.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13707</commentid>
    <comment_count>4</comment_count>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2007-01-19 03:40:39 +0000</bug_when>
    <thetext>(removing spam)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17364</commentid>
    <comment_count>5</comment_count>
    <who name="CecilWard">cecil</who>
    <bug_when>2007-10-23 21:26:50 +0000</bug_when>
    <thetext>As far as I can see all of the above test cases 1-7 are now fixed. We can close this.

However, in for example, test case 1 now correctly reports failure, apart from if CSS1 is selected, when it seems to fall over (error message looks strange).

Some of the other test cases produce the same weird error if CSS1 is selected. I haven&apos;t gone through them all (yet).


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19361</commentid>
    <comment_count>6</comment_count>
      <attachid>528</attachid>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2008-03-07 23:23:28 +0000</bug_when>
    <thetext>Created attachment 528
test case 1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19362</commentid>
    <comment_count>7</comment_count>
      <attachid>529</attachid>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2008-03-07 23:23:49 +0000</bug_when>
    <thetext>Created attachment 529
test case 2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19363</commentid>
    <comment_count>8</comment_count>
      <attachid>530</attachid>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2008-03-07 23:24:13 +0000</bug_when>
    <thetext>Created attachment 530
test case 3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19364</commentid>
    <comment_count>9</comment_count>
      <attachid>531</attachid>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2008-03-07 23:24:35 +0000</bug_when>
    <thetext>Created attachment 531
test case 4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19365</commentid>
    <comment_count>10</comment_count>
      <attachid>532</attachid>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2008-03-07 23:24:52 +0000</bug_when>
    <thetext>Created attachment 532
test case 5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19366</commentid>
    <comment_count>11</comment_count>
      <attachid>533</attachid>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2008-03-07 23:25:17 +0000</bug_when>
    <thetext>Created attachment 533
test case 6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19367</commentid>
    <comment_count>12</comment_count>
      <attachid>534</attachid>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2008-03-07 23:25:43 +0000</bug_when>
    <thetext>Created attachment 534
test case 7</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19368</commentid>
    <comment_count>13</comment_count>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2008-03-08 00:02:20 +0000</bug_when>
    <thetext>Thanks Cecil for the test cases. I added them into the test suite to make sure we don&apos;t have any regression in the future.


</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>528</attachid>
            <date>2008-03-07 23:23:28 +0000</date>
            <delta_ts>2008-03-07 23:23:28 +0000</delta_ts>
            <desc>test case 1</desc>
            <filename>2920-1.css</filename>
            <type>text/css</type>
            <size>108</size>
            <attacher name="Olivier Thereaux">ot</attacher>
            
              <data encoding="base64">QGNoYXJzZXQidXRmLTgiOwpwIHsKICAgIGZvbnQtZmFtaWx5OiAi44OS44Op44Ku44OO6KeS44K0
IFBybyBXMyIsICJIaXJhZ2lubyBLYWt1IEdvdGhpYyBQcm8iLCBzYW5zLXNlcmlmOwp9
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>529</attachid>
            <date>2008-03-07 23:23:49 +0000</date>
            <delta_ts>2008-03-07 23:23:49 +0000</delta_ts>
            <desc>test case 2</desc>
            <filename>2920-2.css</filename>
            <type>text/css</type>
            <size>122</size>
            <attacher name="Olivier Thereaux">ot</attacher>
            
              <data encoding="base64">QGNoYXJzZXQgICAgICAgICAgICAgICJ1dGYtOCI7CnAgewogICAgZm9udC1mYW1pbHk6ICLjg5Lj
g6njgq7jg47op5LjgrQgUHJvIFczIiwgIkhpcmFnaW5vIEtha3UgR290aGljIFBybyIsIHNhbnMt
c2VyaWY7Cn0=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>530</attachid>
            <date>2008-03-07 23:24:13 +0000</date>
            <delta_ts>2008-03-07 23:24:13 +0000</delta_ts>
            <desc>test case 3</desc>
            <filename>2920-3.css</filename>
            <type>text/css</type>
            <size>109</size>
            <attacher name="Olivier Thereaux">ot</attacher>
            
              <data encoding="base64">QGNoYXJzZXQKInV0Zi04IjsKcCB7CiAgICBmb250LWZhbWlseTogIuODkuODqeOCruODjuinkuOC
tCBQcm8gVzMiLCAiSGlyYWdpbm8gS2FrdSBHb3RoaWMgUHJvIiwgc2Fucy1zZXJpZjsKfQ==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>531</attachid>
            <date>2008-03-07 23:24:35 +0000</date>
            <delta_ts>2008-03-07 23:24:35 +0000</delta_ts>
            <desc>test case 4</desc>
            <filename>2920-4.css</filename>
            <type>text/css</type>
            <size>112</size>
            <attacher name="Olivier Thereaux">ot</attacher>
            
              <data encoding="base64">QGNoYXJzZXQvKiovInV0Zi04IjsKcCB7CiAgICBmb250LWZhbWlseTogIuODkuODqeOCruODjuin
kuOCtCBQcm8gVzMiLCAiSGlyYWdpbm8gS2FrdSBHb3RoaWMgUHJvIiwgc2Fucy1zZXJpZjsKfQ==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>532</attachid>
            <date>2008-03-07 23:24:52 +0000</date>
            <delta_ts>2008-03-07 23:24:52 +0000</delta_ts>
            <desc>test case 5</desc>
            <filename>2920-5.css</filename>
            <type>text/css</type>
            <size>110</size>
            <attacher name="Olivier Thereaux">ot</attacher>
            
              <data encoding="base64">QGNoYXJzZXQgInV0Zi04IiA7CnAgewogICAgZm9udC1mYW1pbHk6ICLjg5Ljg6njgq7jg47op5Lj
grQgUHJvIFczIiwgIkhpcmFnaW5vIEtha3UgR290aGljIFBybyIsIHNhbnMtc2VyaWY7Cn0=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>533</attachid>
            <date>2008-03-07 23:25:17 +0000</date>
            <delta_ts>2008-03-07 23:25:17 +0000</delta_ts>
            <desc>test case 6</desc>
            <filename>2920-6.css</filename>
            <type>text/css</type>
            <size>110</size>
            <attacher name="Olivier Thereaux">ot</attacher>
            
              <data encoding="base64">QGNoYXJzZXQgInV0Zi04Igo7CnAgewogICAgZm9udC1mYW1pbHk6ICLjg5Ljg6njgq7jg47op5Lj
grQgUHJvIFczIiwgIkhpcmFnaW5vIEtha3UgR290aGljIFBybyIsIHNhbnMtc2VyaWY7Cn0=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>534</attachid>
            <date>2008-03-07 23:25:43 +0000</date>
            <delta_ts>2008-03-07 23:25:43 +0000</delta_ts>
            <desc>test case 7</desc>
            <filename>2920-7.css</filename>
            <type>text/css</type>
            <size>113</size>
            <attacher name="Olivier Thereaux">ot</attacher>
            
              <data encoding="base64">LyoqL0BjaGFyc2V0ICJ1dGYtOCI7CnAgewogICAgZm9udC1mYW1pbHk6ICLjg5Ljg6njgq7jg47o
p5LjgrQgUHJvIFczIiwgIkhpcmFnaW5vIEtha3UgR290aGljIFBybyIsIHNhbnMtc2VyaWY7Cn0=
</data>

          </attachment>
      

    </bug>

</bugzilla>