Skip to content

Commit 9a51e4a

Browse files
committed
[css-syntax] Add non-normative text to describe escaping.
1 parent b5b7237 commit 9a51e4a

2 files changed

Lines changed: 59 additions & 4 deletions

File tree

css-syntax/Overview.html

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ <h2 class="no-num no-toc no-ref" id=contents><span class=content>Table of conten
6666
<div data-fill-with=table-of-contents><ul class=toc><li><a href=#intro><span class=secno>1</span>
6767
Introduction</a><ul class=toc><li><a href=#placement><span class=secno>1.1</span>
6868
Module interactions</a></ul><li><a href=#syntax-description><span class=secno>2</span>
69-
Description of CSS's Syntax</a><ul class=toc><li><a href=#error-handling><span class=secno>2.1</span>
69+
Description of CSS's Syntax</a><ul class=toc><li><a href=#escaping><span class=secno>2.1</span>
70+
Escaping</a><li><a href=#error-handling><span class=secno>2.2</span>
7071
Error Handling</a></ul><li><a href=#tokenizing-and-parsing-css><span class=secno>3</span>
7172
Tokenizing and Parsing CSS</a><ul class=toc><li><a href=#overview-of-the-parsing-model><span class=secno>3.1</span>
7273
Overview of the Parsing Model</a><li><a href=#the-input-byte-stream><span class=secno>3.2</span>
@@ -243,14 +244,41 @@ <h2 data-level=2 id=syntax-description><span class=secno>2 </span><span class=co
243244
and then can contain letters, numbers, hyphens, or underscores.
244245
You can include any character at all,
245246
even ones that CSS uses in its syntax,
246-
by escaping it with a backslash (\) or by using a hexadecimal escape.
247+
by <a href=#escaping0>escaping</a> it.
247248

248249
<p> The syntax of selectors is defined in the <a href=http://www.w3.org/TR/selectors/>Selectors spec</a>.
249250
Similarly, the syntax of the wide variety of CSS values is defined in the <a href=http://www.w3.org/TR/css3-values/>Values &amp; Units spec</a>.
250251
The special syntaxes of individual <a href=#at-rule>at-rules</a> can be found in the specs that define them.
251252

253+
<h3 data-level=2.1 id=escaping><span class=secno>2.1 </span><span class=content>
254+
Escaping</span><a class=section-link href=#escaping>§</a></h3>
252255

253-
<h3 data-level=2.1 id=error-handling><span class=secno>2.1 </span><span class=content>
256+
<p> <em>This section is not normative.</em>
257+
258+
<p> Any Unicode character can be included in an identifier or quoted string
259+
by <dfn data-dfn-type=link id=escaping0>escaping</dfn> it.
260+
CSS escape sequences start with a backslash (\), and continue with:
261+
262+
<p> <ul>
263+
<li>
264+
Any Unicode character that is not a <a href=#hex-digit>hex digits</a> or a <a href=#newline>newline</a>.
265+
The escape sequence is replaced by that character.
266+
<li>
267+
Or one to six <a href=#hex-digit>hex digits</a>, followed by an optional <a href=#whitespace>whitespace</a>.
268+
The escape sequence is replaced by the Unicode character
269+
whose codepoint number is given by the hexadecimal digits.
270+
This optional whitespace allow hexadecimal escape sequences
271+
to be followed by "real" hex digits.
272+
273+
<p class=example>
274+
An identifier with the value "&amp;B"
275+
could be written as <span class=css data-autolink=maybe>\26 B</span> or <span class=css data-autolink=maybe>\000026B</span>.
276+
277+
<p class=note>
278+
A "real" space after the escape sequence must be doubled.
279+
</ul>
280+
281+
<h3 data-level=2.2 id=error-handling><span class=secno>2.2 </span><span class=content>
254282
Error Handling</span><a class=section-link href=#error-handling>§</a></h3>
255283

256284
<p> <em>This section is not normative.</em>

css-syntax/Overview.src.html

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,39 @@ <h2 id='syntax-description'>
126126
and then can contain letters, numbers, hyphens, or underscores.
127127
You can include any character at all,
128128
even ones that CSS uses in its syntax,
129-
by escaping it with a backslash (\) or by using a hexadecimal escape.
129+
by <a>escaping</a> it.
130130

131131
The syntax of selectors is defined in the <a href="http://www.w3.org/TR/selectors/">Selectors spec</a>.
132132
Similarly, the syntax of the wide variety of CSS values is defined in the <a href="http://www.w3.org/TR/css3-values/">Values &amp; Units spec</a>.
133133
The special syntaxes of individual <a>at-rules</a> can be found in the specs that define them.
134134

135+
<h3>
136+
Escaping</h3>
137+
138+
<em>This section is not normative.</em>
139+
140+
Any Unicode character can be included in an identifier or quoted string
141+
by <dfn>escaping</dfn> it.
142+
CSS escape sequences start with a backslash (\), and continue with:
143+
144+
<ul>
145+
<li>
146+
Any Unicode character that is not a <a>hex digits</a> or a <a>newline</a>.
147+
The escape sequence is replaced by that character.
148+
<li>
149+
Or one to six <a>hex digits</a>, followed by an optional <a>whitespace</a>.
150+
The escape sequence is replaced by the Unicode character
151+
whose codepoint number is given by the hexadecimal digits.
152+
This optional whitespace allow hexadecimal escape sequences
153+
to be followed by "real" hex digits.
154+
155+
<p class=example>
156+
An identifier with the value "&B"
157+
could be written as ''\26 B'' or ''\000026B''.
158+
159+
<p class=note>
160+
A "real" space after the escape sequence must be doubled.
161+
</ul>
135162

136163
<h3>
137164
Error Handling</h3>

0 commit comments

Comments
 (0)