Skip to content

Commit b9607e6

Browse files
committed
move serializing and parsing selectors as well
1 parent 2a8b21e commit b9607e6

2 files changed

Lines changed: 111 additions & 86 deletions

File tree

cssom/Overview.html

Lines changed: 65 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@ <h2 class="no-num no-toc" id=toc>Table of Contents</h2>
165165
of the serializing algorithm </a>
166166
</ul>
167167

168-
<li><a href="#processing"><span class=secno>3.1.2. </span>Processing
168+
<li><a href="#selectors"><span class=secno>3.1.2. </span>Selectors</a>
169+
170+
171+
<li><a href="#css-page"><span class=secno>3.1.3. </span>CSS Page
172+
Selectors</a>
173+
174+
<li><a href="#processing"><span class=secno>3.1.4. </span>Processing
169175
CSS Statements</a>
170176
</ul>
171177

@@ -300,11 +306,9 @@ <h2 class="no-num no-toc" id=toc>Table of Contents</h2>
300306

301307
<li><a href="#canon"><span class=secno>5. </span>Canonicalization </a>
302308
<ul class=toc>
303-
<li><a href="#selectors"><span class=secno>5.1. </span>Selectors</a>
304-
305-
<li><a href="#media"><span class=secno>5.2. </span>Media queries</a>
309+
<li><a href="#media"><span class=secno>5.1. </span>Media queries</a>
306310
<ul class=toc>
307-
<li><a href="#examples1"><span class=secno>5.2.1. </span>Examples</a>
311+
<li><a href="#examples1"><span class=secno>5.1.1. </span>Examples</a>
308312
</ul>
309313
</ul>
310314

@@ -1131,7 +1135,7 @@ <h3 id=parsing><span class=secno>3.1. </span>Parsing and Serializing CSS
11311135
<!--
11321136
statement "[S|CDO|CDC]* [ import [S|CDO|CDC]* ]* [ [ ruleset | media | page ] [S|CDO|CDC]* ]*" ??
11331137
1134-
selectors "S* selector [ COMMA S* selector ]*"
1138+
selectors "*"
11351139
page selectors "S* pseudo_page? S*"
11361140
11371141
declaration "S* declaration" (properties, property values, property priority)
@@ -1150,16 +1154,14 @@ <h4 id=css-values><span class=secno>3.1.1. </span>CSS values</h4>
11501154
operation failed.
11511155

11521156
<ol>
1153-
<li>Remove any leading <a href="#whitespace">whitespace</a> characters.
1154-
1155-
<li>Parse the remainder using the <code>expr</code> production in
1157+
<li>Parse the value using the <code>S* expr</code> production in
11561158
combination with the allowed values for the given <var
11571159
title="">property</var>. If this fails return "null". Otherwise return
11581160
the parsed value.
11591161
</ol>
11601162

1161-
<p>The <code>expr</code> production is defined in the CSS 2.1
1162-
specification. [CSS21]
1163+
<p>The aforementioned production is defined in the CSS 2.1 specification.
1164+
[CSS]
11631165

11641166
<p>The rules for <dfn id=serializing title="CSS value
11651167
serializing">serializing a CSS value</dfn> are as given in the following
@@ -1398,7 +1400,56 @@ <h5 id=examples0><span class=secno>3.1.1.1. </span>Examples of the
13981400
</table>
13991401
</div>
14001402

1401-
<h4 id=processing><span class=secno>3.1.2. </span>Processing CSS Statements</h4>
1403+
<h4 id=selectors><span class=secno>3.1.2. </span>Selectors</h4>
1404+
1405+
<p>The rules for <dfn id=parsing1 title=selectors-parsing>parsing a group
1406+
of selectors</dfn> are as given in the following algorithm. The return
1407+
value is either a group of selectors or "null" (if parsing failed).
1408+
1409+
<ol>
1410+
<li>Parse the value using the <code>selectors_group</code> production. If
1411+
this fails return "null". Otherwise return the parsed value.
1412+
</ol>
1413+
1414+
<p>The aforementioned production is defined in the Selectors specification.
1415+
[Selectors]
1416+
1417+
<p>The rules for <dfn id=serializing0 title="selectors
1418+
serializing">serializing a group of selectors</dfn> are as given in the
1419+
following algorithm:
1420+
1421+
<ol>
1422+
<li>
1423+
<p>Replace one or more consecutive <a href="#whitespace">whitespace</a>
1424+
characters with a single U+0020 character.
1425+
1426+
<li>
1427+
<p>Remove leading and trailing <a href="#whitespace">whitespace</a>.
1428+
1429+
<li>
1430+
<p>Make sure combinators other than the descendant combinator are
1431+
preceded and followed by a single U+0020 character (and not more).
1432+
1433+
<li>
1434+
<p>Make sure each U+002C (<code>,</code>) character is followed by a
1435+
single U+0020 character (and not more).
1436+
1437+
<li>
1438+
<p>Convert pseudo-classes and pseudo-elements to their canonical form as
1439+
given in the specification. <span class=note><code>:HOver</code> becomes
1440+
<code>:hover</code> and <code>:befoRe</code> becomes
1441+
<code>::before</code> for example.</span>
1442+
1443+
<li>
1444+
<p class=issue>Hmm, what about pseudo-classes taking arguments? Attribute
1445+
selectors? Namespace prefixes?
1446+
</ol>
1447+
1448+
<h4 id=css-page><span class=secno>3.1.3. </span>CSS Page Selectors</h4>
1449+
1450+
<p class=issue>...
1451+
1452+
<h4 id=processing><span class=secno>3.1.4. </span>Processing CSS Statements</h4>
14021453

14031454
<p>The rules for <dfn id=inserting title="insert a statement">inserting a
14041455
statement</dfn> are as given in the following algorithm. The variables
@@ -3136,42 +3187,7 @@ <h2 id=canon><span class=secno>5. </span>Canonicalization</h2>
31363187
<p>The definitions from this section are used later to define attribute
31373188
values, et cetera.
31383189

3139-
<h3 id=selectors><span class=secno>5.1. </span>Selectors</h3>
3140-
3141-
<p>The <dfn id=canon-selectors>canonicalization of a group of
3142-
selectors</dfn> can be determined as follows:
3143-
3144-
<ol>
3145-
<li><a href="#canonicalization" title=canon-selector>Normalize the
3146-
individual selectors</a>.
3147-
3148-
<li>Separate those selectors by a literal U+002C COMMA and U+0020 SPACE.
3149-
</ol>
3150-
3151-
<p>The <dfn id=canonicalization title=canon-selector>canonicalization of a
3152-
selector</dfn> can be determined as follows:
3153-
3154-
<ol>
3155-
<li>Take the literal input.
3156-
3157-
<li>Replace one or more consecutive <a href="#whitespace">whitespace</a>
3158-
characters with a U+0020 SPACE.
3159-
3160-
<li>Remove leading and trailing <a href="#whitespace">whitespace</a>.
3161-
3162-
<li>Make sure combinators other than the descendant combinator are
3163-
preceded and followed by a U+0020 SPACE. (So only insert it when it's not
3164-
there already.)
3165-
3166-
<li>Pseudo-classes and pseudo-elements are to be converted to their
3167-
canonical form. <code>:HOver</code> becomes <code>:hover</code> and
3168-
<code>:befoRe</code> becomes <code>::before</code> for example.
3169-
</ol>
3170-
3171-
<p class=issue>Hmm, what about pseudo-classes taking arguments? Attribute
3172-
selectors? Namespace prefixes?
3173-
3174-
<h3 id=media><span class=secno>5.2. </span>Media queries</h3>
3190+
<h3 id=media><span class=secno>5.1. </span>Media queries</h3>
31753191

31763192
<p>The <dfn id=canon-media title=canon-media>canonicalization of a media
31773193
query</dfn> can be determined as follows:
@@ -3205,7 +3221,7 @@ <h3 id=media><span class=secno>5.2. </span>Media queries</h3>
32053221

32063222
<p class=issue>duplicate features?
32073223

3208-
<h4 id=examples1><span class=secno>5.2.1. </span>Examples</h4>
3224+
<h4 id=examples1><span class=secno>5.1.1. </span>Examples</h4>
32093225

32103226
<div class=example>
32113227
<p>The canonical form of the following query:</p>

cssom/Overview.src.html

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ <h3>Parsing and Serializing CSS Constructs</h3>
820820
<!--
821821
statement "[S|CDO|CDC]* [ import [S|CDO|CDC]* ]* [ [ ruleset | media | page ] [S|CDO|CDC]* ]*" ??
822822
823-
selectors "S* selector [ COMMA S* selector ]*"
823+
selectors "*"
824824
page selectors "S* pseudo_page? S*"
825825
826826
declaration "S* declaration" (properties, property values, property priority)
@@ -839,15 +839,13 @@ <h4>CSS values</h4>
839839
The result is either a CSS value or "null" if the operation failed.</p>
840840

841841
<ol>
842-
<li>Remove any leading <span>whitespace</span> characters.</li>
843-
844-
<li>Parse the remainder using the <code>expr</code> production in combination
842+
<li>Parse the value using the <code>S* expr</code> production in combination
845843
with the allowed values for the given <var title="">property</var>. If this
846844
fails return "null". Otherwise return the parsed value.</li>
847845
</ol>
848846

849-
<p>The <code>expr</code> production is defined in the CSS 2.1
850-
specification. [CSS21]</p>
847+
<p>The aforementioned production is defined in the CSS 2.1 specification.
848+
[CSS]</p>
851849

852850

853851
<p>The rules for <dfn title="CSS value serializing">serializing a CSS
@@ -1025,6 +1023,48 @@ <h5>Examples of the serializing algorithm</h4>
10251023

10261024

10271025

1026+
<h4>Selectors</h4>
1027+
1028+
<p>The rules for <dfn title="selectors-parsing">parsing a group of
1029+
selectors</dfn> are as given in the following algorithm. The return value is
1030+
either a group of selectors or "null" (if parsing failed).</p>
1031+
1032+
<ol>
1033+
<li>Parse the value using the <code>selectors_group</code> production. If
1034+
this fails return "null". Otherwise return the parsed value.</li>
1035+
</ol>
1036+
1037+
<p>The aforementioned production is defined in the Selectors specification.
1038+
[Selectors]</p>
1039+
1040+
<p>The rules for <dfn title="selectors serializing">serializing a group of
1041+
selectors</dfn> are as given in the following algorithm:</p>
1042+
1043+
<ol>
1044+
<li><p>Replace one or more consecutive <span>whitespace</span> characters
1045+
with a single U+0020 character.</p></li>
1046+
1047+
<li><p>Remove leading and trailing <span>whitespace</span>.</p></li>
1048+
1049+
<li><p>Make sure combinators other than the descendant combinator are
1050+
preceded and followed by a single U+0020 character (and not more).</p></li>
1051+
1052+
<li><p>Make sure each U+002C (<code>,</code>) character is followed by a
1053+
single U+0020 character (and not more).</p></li>
1054+
1055+
<li><p>Convert pseudo-classes and pseudo-elements to their canonical form as
1056+
given in the specification. <span class="note"><code>:HOver</code> becomes
1057+
<code>:hover</code> and <code>:befoRe</code> becomes <code>::before</code>
1058+
for example.</span></p></li>
1059+
1060+
<li><p class="issue">Hmm, what about pseudo-classes taking arguments?
1061+
Attribute selectors? Namespace prefixes?</p></li>
1062+
</ol>
1063+
1064+
<h4>CSS Page Selectors</h4>
1065+
1066+
<p class="issue">...</p>
1067+
10281068

10291069
<h4>Processing CSS Statements</h4>
10301070

@@ -2601,37 +2641,6 @@ <h2 id="canon" >Canonicalization</h4>
26012641
<p>The definitions from this section are used later to define attribute
26022642
values, et cetera.</p>
26032643

2604-
<h3>Selectors</h3>
2605-
2606-
<p>The <dfn id="canon-selectors">canonicalization of a group of
2607-
selectors</dfn> can be determined as follows:</p>
2608-
2609-
<ol>
2610-
<li><span title="canon-selector">Normalize the individual
2611-
selectors</span>.</li>
2612-
2613-
<li>Separate those selectors by a literal U+002C COMMA and U+0020
2614-
SPACE.</li>
2615-
</ol>
2616-
2617-
<p>The <dfn title="canon-selector">canonicalization of a selector</dfn> can be
2618-
determined as follows:</p>
2619-
2620-
<ol>
2621-
<li>Take the literal input.</li>
2622-
<li>Replace one or more consecutive <span>whitespace</span> characters with
2623-
a U+0020 SPACE.</li>
2624-
<li>Remove leading and trailing <span>whitespace</span>.</li>
2625-
<li>Make sure combinators other than the descendant combinator are
2626-
preceded and followed by a U+0020 SPACE. (So only insert it when it's not
2627-
there already.)</li>
2628-
<li>Pseudo-classes and pseudo-elements are to be converted to their
2629-
canonical form. <code>:HOver</code> becomes <code>:hover</code> and
2630-
<code>:befoRe</code> becomes <code>::before</code> for example.</li>
2631-
</ol>
2632-
2633-
<p class="issue">Hmm, what about pseudo-classes taking arguments? Attribute
2634-
selectors? Namespace prefixes?</p>
26352644

26362645
<h3>Media queries</h3>
26372646

0 commit comments

Comments
 (0)