@@ -91,6 +91,9 @@ <h2 class="no-num no-toc" id=toc>Table of Contents</h2>
9191
9292 < li > < a href ="#conformance "> < span class =secno > 2.2. </ span > Conformance
9393 Requirements</ a >
94+
95+ < li > < a href ="#common-serializing-idioms "> < span class =secno > 2.3.
96+ </ span > Common Serializing Idioms</ a >
9497 </ ul >
9598
9699 < li > < a href ="#media-queries "> < span class =secno > 3. </ span > Media Queries</ a >
@@ -331,6 +334,78 @@ <h3 id=conformance><span class=secno>2.2. </span>Conformance Requirements</h3>
331334 </dl>
332335-->
333336
337+ < h3 id =common-serializing-idioms > < span class =secno > 2.3. </ span > Common
338+ Serializing Idioms</ h3 >
339+
340+ < p > To < dfn id =escape-a-character > escape a character</ dfn > means to create a
341+ string of "< code > \</ code > " (U+005C), followed by the character.
342+
343+ < p > To < dfn id =escape-a-character-as-code-point > escape a character as code
344+ point</ dfn > means to create a string of "< code > \</ code > " (U+005C),
345+ followed by the Unicode code point as the smallest possible number of
346+ hexadecimal digits in the range 0-9 a-f (U+0030 to U+0039 and U+0061 to
347+ U+0066) to represent the code point in base 16, followed by a space
348+ (U+0020).
349+
350+ < p > To < dfn id =escape-an-identifier > escape an identifier</ dfn > means to
351+ create a string represented by the concatenation of, for each character of
352+ the identifier:
353+
354+ < ul >
355+ < li > If the character is in the range U+0000 to U+001F, the character < a
356+ href ="#escape-a-character-as-code-point " title ="escape a character as
357+ code point "> escaped as code point</ a > .
358+
359+ < li > If the character is the first character and is in the range 0-9
360+ (U+0030 to U+0039), the character < a
361+ href ="#escape-a-character-as-code-point " title ="escape a character as
362+ code point "> escaped as code point</ a > .
363+
364+ < li > If the character is the second character and is in the range 0-9
365+ (U+0030 to U+0039) and the first character is a "< code > -</ code > "
366+ (U+002D), the character < a href ="#escape-a-character-as-code-point "
367+ title ="escape a character as code point "> escaped as code point</ a > .
368+
369+ < li > If the character is the second character and is "< code > -</ code > "
370+ (U+002D) and the first character is "< code > -</ code > " too, the < a
371+ href ="#escape-a-character " title ="escape a character "> escaped</ a >
372+ character.
373+
374+ < li > If the character is not handled by one of the above rules and is
375+ greater than or equal to U+0080, is "< code > -</ code > " (U+002D) or
376+ "< code > _</ code > " (U+005F), or is in one of the ranges 0-9 (U+0030 to
377+ U+0039), A-Z (U+0041 to U+005A), or a-z (U+0061 to U+007A), the character
378+ itself.
379+
380+ < li > Otherwise, the < a href ="#escape-a-character " title ="escape a
381+ character "> escaped</ a > character.
382+ </ ul >
383+
384+ < p > To < dfn id =escape-a-string > escape a string</ dfn > means to create a
385+ string represented by '< code > "</ code > ' (U+0022), followed by the result of
386+ applying the rules below to each character of the given string, followed
387+ by '< code > "</ code > ' (U+0022):
388+
389+ < ul >
390+ < li > If the character is in the range U+0000 to U+001F, the character < a
391+ href ="#escape-a-character-as-code-point " title ="escape a character as
392+ code point "> escaped as code point</ a > .
393+
394+ < li > If the character is '< code > "</ code > ' (U+0022) or '< code > \</ code > '
395+ (U+005C), the < a href ="#escape-a-character " title ="escape a
396+ character "> escaped</ a > character.
397+
398+ < li > Otherwise, the character itself.
399+ </ ul >
400+
401+ < p class =note > "< code > '</ code > " (U+0027) is not escaped because strings are
402+ always serialized with '< code > "</ code > ' (U+0022).
403+
404+ < p > To < dfn id =escape-a-url > escape a URL</ dfn > means to create a string
405+ represented by "< code title =""> url(</ code > ", followed by the < a
406+ href ="#escape-a-string " title ="escape a string "> string escaped</ a > value
407+ of the given string, followed by "< code > )</ code > ".
408+
334409 < h2 id =media-queries > < span class =secno > 3. </ span > Media Queries</ h2 >
335410
336411 < p > < dfn id ="media queries "> Media queries</ dfn > are defined by the Media
@@ -3638,77 +3713,6 @@ <h4 id=serializing-css-values><span class=secno>5.6.2. </span>Serializing
36383713 CSS3/CSS4 timeline by moving the above definitions to the drafts that
36393714 define the CSS components.
36403715
3641- < hr >
3642-
3643- < p > To < dfn id =escape-a-character > escape a character</ dfn > means to create a
3644- string of "< code > \</ code > " (U+005C), followed by the character.
3645-
3646- < p > To < dfn id =escape-a-character-as-code-point > escape a character as code
3647- point</ dfn > means to create a string of "< code > \</ code > " (U+005C),
3648- followed by the Unicode code point as the smallest possible number of
3649- hexadecimal digits in the range 0-9 a-f (U+0030 to U+0039 and U+0061 to
3650- U+0066) to represent the code point in base 16, followed by a space
3651- (U+0020).
3652-
3653- < p > To < dfn id =escape-an-identifier > escape an identifier</ dfn > means to
3654- create a string represented by the concatenation of, for each character of
3655- the identifier:
3656-
3657- < ul >
3658- < li > If the character is in the range U+0000 to U+001F, the character < a
3659- href ="#escape-a-character-as-code-point " title ="escape a character as
3660- code point "> escaped as code point</ a > .
3661-
3662- < li > If the character is the first character and is in the range 0-9
3663- (U+0030 to U+0039), the character < a
3664- href ="#escape-a-character-as-code-point " title ="escape a character as
3665- code point "> escaped as code point</ a > .
3666-
3667- < li > If the character is the second character and is in the range 0-9
3668- (U+0030 to U+0039) and the first character is a "< code > -</ code > "
3669- (U+002D), the character < a href ="#escape-a-character-as-code-point "
3670- title ="escape a character as code point "> escaped as code point</ a > .
3671-
3672- < li > If the character is the second character and is "< code > -</ code > "
3673- (U+002D) and the first character is "< code > -</ code > " too, the < a
3674- href ="#escape-a-character " title ="escape a character "> escaped</ a >
3675- character.
3676-
3677- < li > If the character is not handled by one of the above rules and is
3678- greater than or equal to U+0080, is "< code > -</ code > " (U+002D) or
3679- "< code > _</ code > " (U+005F), or is in one of the ranges 0-9 (U+0030 to
3680- U+0039), A-Z (U+0041 to U+005A), or a-z (U+0061 to U+007A), the character
3681- itself.
3682-
3683- < li > Otherwise, the < a href ="#escape-a-character " title ="escape a
3684- character "> escaped</ a > character.
3685- </ ul >
3686-
3687- < p > To < dfn id =escape-a-string > escape a string</ dfn > means to create a
3688- string represented by '< code > "</ code > ' (U+0022), followed by the result of
3689- applying the rules below to each character of the given string, followed
3690- by '< code > "</ code > ' (U+0022):
3691-
3692- < ul >
3693- < li > If the character is in the range U+0000 to U+001F, the character < a
3694- href ="#escape-a-character-as-code-point " title ="escape a character as
3695- code point "> escaped as code point</ a > .
3696-
3697- < li > If the character is '< code > "</ code > ' (U+0022) or '< code > \</ code > '
3698- (U+005C), the < a href ="#escape-a-character " title ="escape a
3699- character "> escaped</ a > character.
3700-
3701- < li > Otherwise, the character itself.
3702- </ ul >
3703-
3704- < p class =note > "< code > '</ code > " (U+0027) is not escaped because strings are
3705- always serialized with '< code > "</ code > ' (U+0022).
3706-
3707- < p > To < dfn id =escape-a-url > escape a URL</ dfn > means to create a string
3708- represented by "< code title =""> url(</ code > ", followed by the < a
3709- href ="#escape-a-string " title ="escape a string "> string escaped</ a > value
3710- of the given string, followed by "< code > )</ code > ".
3711-
37123716 < h5 id =examples0 > < span class =secno > 5.6.2.1. </ span > Examples</ h5 >
37133717
37143718 < p > Here are some examples of before and after results on specified values.
0 commit comments