Skip to content

Commit 02624fb

Browse files
committed
[css-syntax] Clarify the note on the @charset "XXX"; byte sequence
1 parent 68d6f5e commit 02624fb

2 files changed

Lines changed: 26 additions & 18 deletions

File tree

css-syntax/Overview.html

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4490,15 +4490,19 @@ <h3 class="heading settled heading" data-level=8.2 id=charset-rule><span class=s
44904490

44914491
<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>.
44924492

4493-
<p class=note> Note: However, the algorithm to <a data-link-type=dfn href=#determine-the-fallback-encoding title="determine the fallback encoding">determine the fallback encoding</a>
4494-
looks at the first several bytes of the stylesheet
4495-
to see if they’re a match for the ASCII characters <code>@charset "XXX";</code>,
4496-
where XXX is a sequence of bytes other than 22 (ASCII for <code>"</code>).
4497-
While this resembles an <a class=css data-link-type=maybe href=#at-ruledef-charset title=@charset>@charset</a> rule,
4498-
it’s not actually the same thing.
4499-
For example, the necessary sequence of bytes will spell out something entirely different
4500-
if the stylesheet is in an encoding that’s not ASCII-compatible,
4501-
such as UTF-16.
4493+
<div class=note>
4494+
Note: This only applies to the <a data-link-type=dfn href=#at-rule title=at-rule>at-rule</a>
4495+
created by the algorithm to <a data-link-type=dfn href=#parse-a-stylesheet0 title="parse a stylesheet">parse a stylesheet</a>,
4496+
not to the ASCII <code>@charset "XXX";</code> byte sequence
4497+
that the algorithm to <a data-link-type=dfn href=#determine-the-fallback-encoding title="determine the fallback encoding">determine the fallback encoding</a>
4498+
looks for at the beginning of a stylesheet.
4499+
4500+
<p> While they look similar, they are not actually the same thing.
4501+
For example, a slightly different byte sequence
4502+
(more whitespace, single instead of double quotes, …)
4503+
will not be considered for the fallback encoding
4504+
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>.
4505+
</div>
45024506

45034507

45044508

css-syntax/Overview.src.html

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,15 +3016,19 @@ <h3 id='charset-rule'>
30163016

30173017
The ''@charset'' rule has <strong>no effect on a stylesheet</strong>.
30183018

3019-
Note: However, the algorithm to <a>determine the fallback encoding</a>
3020-
looks at the first several bytes of the stylesheet
3021-
to see if they're a match for the ASCII characters <code>@charset "XXX";</code>,
3022-
where XXX is a sequence of bytes other than 22 (ASCII for <code>"</code>).
3023-
While this resembles an ''@charset'' rule,
3024-
it's not actually the same thing.
3025-
For example, the necessary sequence of bytes will spell out something entirely different
3026-
if the stylesheet is in an encoding that's not ASCII-compatible,
3027-
such as UTF-16.
3019+
<div class='note'>
3020+
Note: This only applies to the <a>at-rule</a>
3021+
created by the algorithm to <a>parse a stylesheet</a>,
3022+
not to the ASCII <code>@charset "XXX";</code> byte sequence
3023+
that the algorithm to <a>determine the fallback encoding</a>
3024+
looks for at the beginning of a stylesheet.
3025+
3026+
While they look similar, they are not actually the same thing.
3027+
For example, a slightly different byte sequence
3028+
(more whitespace, single instead of double quotes, …)
3029+
will not be considered for the fallback encoding
3030+
but may still generate an ''@charset'' rule that shows up in [[CSSOM]].
3031+
</div>
30283032

30293033

30303034

0 commit comments

Comments
 (0)