|
54 | 54 | </p> |
55 | 55 | <h1 class="p-name no-ref" id=title>CSS Syntax Module Level 3</h1> |
56 | 56 | <h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft, |
57 | | - <span class=dt-updated><span class=value-title title=20140108>8 January 2014</span></span></span></h2> |
| 57 | + <span class=dt-updated><span class=value-title title=20140115>15 January 2014</span></span></span></h2> |
58 | 58 | <div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-syntax/>http://dev.w3.org/csswg/css-syntax/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-syntax-3/>http://www.w3.org/TR/css-syntax-3/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-syntax/>http://dev.w3.org/csswg/css-syntax/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/</a><dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/</a> |
59 | 59 | <dt>Feedback:</dt> |
60 | 60 | <dd><a href="mailto:www-style@w3.org?subject=%5Bcss-syntax%5D%20feedback">www-style@w3.org</a> |
@@ -4499,17 +4499,29 @@ <h3 class="heading settled heading" data-level=8.2 id=charset-rule><span class=s |
4499 | 4499 | <p> The <a class=css data-link-type=maybe href=#at-ruledef-charset title=@charset>@charset</a> rule has <strong>no effect on a stylesheet</strong>. |
4500 | 4500 |
|
4501 | 4501 | <div class=note> |
4502 | | - Note: This only applies to the <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> |
4503 | | - created by the algorithm to <a data-link-type=dfn href=#parse-a-stylesheet0 title="parse a stylesheet">parse a stylesheet</a>, |
4504 | | - not to the ASCII <code>@charset "XXX";</code> byte sequence |
4505 | | - that the algorithm to <a data-link-type=dfn href=#determine-the-fallback-encoding title="determine the fallback encoding">determine the fallback encoding</a> |
4506 | | - looks for at the beginning of a stylesheet. |
4507 | | - |
4508 | | -<p> While they look similar, they are not actually the same thing. |
4509 | | - For example, a slightly different byte sequence |
4510 | | - (more whitespace, single instead of double quotes, …) |
4511 | | - will not be considered for the fallback encoding |
4512 | | - but may still generate an <a class=css data-link-type=maybe href=#at-ruledef-charset title=@charset>@charset</a> rule that shows up in <a data-biblio-type=informative data-link-type=biblio href=#cssom title=cssom>[CSSOM]</a>. |
| 4502 | + Confused? |
| 4503 | + Note that the preceding paragraph is talking about the <a class=css data-link-type=maybe href=#at-ruledef-charset title=@charset>@charset</a> <strong><a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a></strong>. |
| 4504 | + CSS looks for a byte sequence that looks like "@charset" at the beginning of the document |
| 4505 | + to receive encoding enformation. |
| 4506 | + This is thematically similar to other encoding sequences at the beginning of files, |
| 4507 | + like a byte-order mark (BOM) hinting at the type of Unicode encoding used, |
| 4508 | + a DOCTYPE in an HTML document, |
| 4509 | + or a magic string like "MANIFEST" at the start of an HTML manifest. |
| 4510 | + |
| 4511 | +<p> This byte sequence happens to <em>look</em> like a normal CSS rule, however, |
| 4512 | + and for legacy reasons, |
| 4513 | + that rule is reflected as an <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> in the CSS Object Model <a data-biblio-type=informative data-link-type=biblio href=#cssom title=cssom>[CSSOM]</a>. |
| 4514 | + However, <strong>that at-rule object does nothing</strong>; |
| 4515 | + modifying it has no effect on the stylesheet, |
| 4516 | + nor does creating a fresh one and inserting it into a stylesheet. |
| 4517 | + |
| 4518 | +<p> Note that some syntax that qualifies as a valid <a class=css data-link-type=maybe href=#at-ruledef-charset title=@charset>@charset</a> <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a> |
| 4519 | + is <strong>not</strong> a valid encoding declaration. |
| 4520 | + For example, since its argument is a string, |
| 4521 | + it can be written with single quotes around it. |
| 4522 | + This will create a valid <a class=css data-link-type=maybe href=#at-ruledef-charset title=@charset>@charset</a> rule, |
| 4523 | + but it won’t be recognized by the encoding detection step, |
| 4524 | + as it’s not the exact byte sequence that the algorithm requires. |
4513 | 4525 | </div> |
4514 | 4526 |
|
4515 | 4527 |
|
|
0 commit comments