Skip to content

Commit 7b02cb6

Browse files
committed
[css-syntax] Add all the 'omitted A' clauses to An+B. Make some An+B dfns linkify better.
1 parent 506afb7 commit 7b02cb6

2 files changed

Lines changed: 158 additions & 60 deletions

File tree

css-syntax/Overview.html

Lines changed: 119 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<meta content="CSS Syntax Module Level 3 (CSS3 Syntax)" name=dcterms.title>
1313
<meta content=text name=dcterms.type>
14-
<meta content=2013-05-10 name=dcterms.date>
14+
<meta content=2013-05-13 name=dcterms.date>
1515
<meta content="Tab Atkins Jr." name=dcterms.creator>
1616
<meta content=W3C name=dcterms.publisher>
1717
<meta content="http://dev.w3.org/csswg/css3-syntax/"
@@ -32,7 +32,7 @@
3232
<h1 class=p-name>CSS Syntax Module Level 3</h1>
3333

3434
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft <time
35-
class=dt-updated datetime=20130510>10 May 2013</time></h2>
35+
class=dt-updated datetime=20130513>13 May 2013</time></h2>
3636

3737
<dl>
3838
<dt>This version:
@@ -3903,30 +3903,31 @@ <h3 id=changes-from-css-2.1-core-grammar><span class=secno>5.5. </span>
39033903
</ul>
39043904
</ol>
39053905

3906-
<h2 id=anb><span class=secno>6. </span> The <var>An+B</var> microsyntax</h2>
3906+
<h2 id=anb><span class=secno>6. </span> The <a
3907+
href="#anb0"><var>An+B</var></a> microsyntax</h2>
39073908

39083909
<p> Several things in CSS, such as the ‘<code
39093910
class=css>:nth-child()</code>’ pseudoclass, need to indicate indexes in
3910-
a list. The <var>An+B</var> microsyntax is useful for this, allowing an
3911-
author to easily indicate single elements or all elements at
3912-
regularly-spaced intervals in a list.
3911+
a list. The <a href="#anb0"><var>An+B</var></a> microsyntax is useful for
3912+
this, allowing an author to easily indicate single elements or all
3913+
elements at regularly-spaced intervals in a list.
39133914

3914-
<p> The <var>An+B</var> notation defines an integer step (<dfn
3915-
id=a>A</dfn>) and offset (<dfn id=b>B</dfn>), and represents the
3916-
<var>An+B</var>th elements in a list, for every positive integer or zero
3917-
value of <var>n</var>, with the first element in the list having index 1
3918-
(not 0).
3915+
<p> The <dfn id=anb0>An+B</dfn> notation defines an integer step (<dfn
3916+
id=a>A</dfn>) and offset (<dfn id=b>B</dfn>), and represents the <a
3917+
href="#anb0"><var>An+B</var></a>th elements in a list, for every positive
3918+
integer or zero value of <var>n</var>, with the first element in the list
3919+
having index 1 (not 0).
39193920

39203921
<p> For values of <a href="#a"><var>A</var></a> and <a
39213922
href="#b"><var>B</var></a> greater than 0, this effectively dividies the
39223923
list into groups of <a href="#a"><var>A</var></a> elements (the last group
39233924
taking the remainder), and selecting the <a href="#b"><var>B</var></a>th
39243925
element of each group.
39253926

3926-
<p> The <var>An+B</var> notation also accepts the<code
3927-
class=css>even</code>’ and ‘<code class=css>odd</code> keywords,
3928-
which have the same meaning as ‘<code class=css>2n</code> and
3929-
<code class=css>2n+1</code>’, respectively.
3927+
<p> The <a href="#anb0"><var>An+B</var></a> notation also accepts the
3928+
<code class=css>even</code>’ and ‘<code class=css>odd</code>
3929+
keywords, which have the same meaning as ‘<code class=css>2n</code>
3930+
and <code class=css>2n+1</code>’, respectively.
39303931

39313932
<div class=example>
39323933
<p>Examples:
@@ -3941,7 +3942,7 @@ <h2 id=anb><span class=secno>6. </span> The <var>An+B</var> microsyntax</h2>
39413942

39423943
<p> The values of <a href="#a"><var>A</var></a> and <a
39433944
href="#b"><var>B</var></a> can be negative, but only the positive results
3944-
of <var>An+B</var>, for <var>n</var> ≥ 0, are used.
3945+
of <a href="#anb0"><var>An+B</var></a>, for <var>n</var> ≥ 0, are used.
39453946

39463947
<div class=example>
39473948
<p>Example:
@@ -4032,24 +4033,51 @@ <h3 id=anb-syntax><span class=secno>6.1. </span> Informal Syntax
40324033
<h3 id=the-anb-type><span class=secno>6.2. </span> The <a
40334034
href="#anb-production"><code>&lt;an+b></code></a> type</h3>
40344035

4035-
<p> The <var>An+B</var> notation is defined using a slightly different
4036-
tokenizer than the rest of CSS, resulting in a somewhat odd definition
4037-
when expressed in terms of CSS tokens. This section describes how to
4038-
recognize the <var>An+B</var> notation in terms of CSS tokens (thus
4039-
defining the <code>&lt;an+b type for CSS grammar purposes), and how to
4040-
interpret the CSS tokens to obtain values for <a
4041-
href="#a"><var>A</var></a> and <a href="#b"><var>B</var></a>. </code>
4036+
<p> The <a href="#anb0"><var>An+B</var></a> notation is defined using a
4037+
slightly different tokenizer than the rest of CSS, resulting in a somewhat
4038+
odd definition when expressed in terms of CSS tokens. This section
4039+
describes how to recognize the <a href="#anb0"><var>An+B</var></a>
4040+
notation in terms of CSS tokens (thus defining the <a
4041+
href="#anb-production"><var>&lt;an+b></var></a> type for CSS grammar
4042+
purposes), and how to interpret the CSS tokens to obtain values for <a
4043+
href="#a"><var>A</var></a> and <a href="#b"><var>B</var></a>.
40424044

4043-
<p> The <dfn id=anb-production>&lt;an+b></dfn> type is defined as:
4045+
<p> The <a href="#anb-production"><var>&lt;an+b></var></a> type is defined
4046+
as:
40444047

40454048
<pre class=prod>
40464049
<dfn id=anb-production>&lt;an+b></dfn> =
40474050
odd | even |
4048-
&lt;integer> |
4049-
&lt;n-dimension> |
4050-
&lt;ndashdigit-dimension> |
4051-
&lt;n-dimension> &lt;signed-integer> |
4052-
&lt;n-dimension> ['+' | '-'] &lt;signless-integer></pre>
4051+
<a
4052+
href="#ltinteger"><var>&lt;integer></var></a> |
4053+
4054+
<a
4055+
href="#ltn-dimension"><var>&lt;n-dimension></var></a> |
4056+
'+'? n |
4057+
-n |
4058+
4059+
<a
4060+
href="#ltndashdigit-dimension"><var>&lt;ndashdigit-dimension></var></a> |
4061+
'+'? <a
4062+
href="#ltndashdigit-ident"><var>&lt;ndashdigit-ident></var></a> |
4063+
<a
4064+
href="#ltdashndashdigit-ident"><var>&lt;dashndashdigit-ident></var></a> |
4065+
4066+
<a
4067+
href="#ltn-dimension"><var>&lt;n-dimension></var></a> <a
4068+
href="#ltsigned-integer"><var>&lt;signed-integer></var></a> |
4069+
'+'? n <a
4070+
href="#ltsigned-integer"><var>&lt;signed-integer></var></a> |
4071+
-n <a
4072+
href="#ltsigned-integer"><var>&lt;signed-integer></var></a> |
4073+
4074+
<a
4075+
href="#ltn-dimension"><var>&lt;n-dimension></var></a> ['+' | '-'] <a
4076+
href="#ltsignless-integer"><var>&lt;signless-integer></var></a>
4077+
'+'? n ['+' | '-'] <a
4078+
href="#ltsignless-integer"><var>&lt;signless-integer></var></a> |
4079+
-n ['+' | '-'] <a
4080+
href="#ltsignless-integer"><var>&lt;signless-integer></var></a></pre>
40534081

40544082
<p> where:
40554083

@@ -4066,6 +4094,19 @@ <h3 id=the-anb-type><span class=secno>6.2. </span> The <a
40664094
match for "n-*", where "*" is a series of one or more <a
40674095
href="#digit"><i>digits</i></a>
40684096

4097+
<li><dfn id=ltndashdigit-ident><code>&lt;ndashdigit-ident></code></dfn> is
4098+
an IDENT token whose representation is an <a
4099+
href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a> match
4100+
for "n-*", where "*" is a series of one or more <a
4101+
href="#digit"><i>digits</i></a>
4102+
4103+
<li><dfn
4104+
id=ltdashndashdigit-ident><code>&lt;dashndashdigit-ident></code></dfn> is
4105+
an IDENT token whose representation is an <a
4106+
href="#ascii-case-insensitive"><i>ASCII case-insensitive</i></a> match
4107+
for "-n-*", where "*" is a series of one or more <a
4108+
href="#digit"><i>digits</i></a>
4109+
40694110
<li><dfn id=ltinteger><code>&lt;integer></code></dfn> is a NUMBER token
40704111
with its type flag set to "integer"
40714112

@@ -4091,32 +4132,58 @@ <h3 id=the-anb-type><span class=secno>6.2. </span> The <a
40914132
<dd> <a href="#a"><var>A</var></a> is 2, <a href="#b"><var>B</var></a> is
40924133
0.
40934134

4094-
<dt><a href="#ltinteger"><code>&lt;integer></code></a>
4135+
<dt><a href="#ltinteger"><code><var>&lt;integer></var></code></a>
40954136

40964137
<dd> <a href="#a"><var>A</var></a> is 0, <a href="#b"><var>B</var></a> is
40974138
the integer.
40984139

4099-
<dt><a href="#ltn-dimension"><code>&lt;n-dimension></code></a>
4140+
<dt><a href="#ltn-dimension"><code><var>&lt;n-dimension></var></code></a>
4141+
4142+
<dt><code>'+'? n</code>
4143+
4144+
<dt><code>-n</code>
41004145

4101-
<dd> <a href="#a"><var>A</var></a> is the dimension's value, <a
4102-
href="#b"><var>B</var></a> is 0.
4146+
<dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
4147+
respectively. <a href="#b"><var>B</var></a> is 0.
41034148

41044149
<dt><a
4105-
href="#ltndashdigit-dimension"><code>&lt;ndashdigit-dimension></code></a>
4150+
href="#ltndashdigit-dimension"><code><var>&lt;ndashdigit-dimension></var></code></a>
41064151

4107-
<dd> <a href="#a"><var>A</var></a> is the dimension's value, <a
4108-
href="#b"><var>B</var></a> is the dimension's unit, with the first two
4109-
characters removed and the remainder interpreted as a base-10 number.
4152+
<dt><code>'+'? <a
4153+
href="#ltndashdigit-ident"><var>&lt;ndashdigit-ident></var></a></code>
4154+
4155+
<dt><a
4156+
href="#ltdashndashdigit-ident"><code><var>&lt;dashndashdigit-ident></var></code></a>
41104157

4111-
<dt><code>&lt;n-dimension> &lt;signed-integer></code>
4158+
<dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
4159+
respectively. <a href="#b"><var>B</var></a> is the dimension's unit, with
4160+
the first two characters removed and the remainder interpreted as a
4161+
base-10 number.
41124162

4113-
<dd> <a href="#a"><var>A</var></a> is the dimension's value, <a
4114-
href="#b"><var>B</var></a> is the integer
4163+
<dt><code><a href="#ltn-dimension"><var>&lt;n-dimension></var></a> <a
4164+
href="#ltsigned-integer"><var>&lt;signed-integer></var></a></code>
41154165

4116-
<dt><code>&lt;n-dimension> ['+' | '-'] &lt;signless-integer></code>
4166+
<dt><code>'+'? n <a
4167+
href="#ltsigned-integer"><var>&lt;signed-integer></var></a></code>
41174168

4118-
<dd> <a href="#a"><var>A</var></a> is the dimension's value, <a
4119-
href="#b"><var>B</var></a> is the integer. If a ‘<code
4169+
<dt><code>-n <a
4170+
href="#ltsigned-integer"><var>&lt;signed-integer></var></a></code>
4171+
4172+
<dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
4173+
respectively. <a href="#b"><var>B</var></a> is the integer.
4174+
4175+
<dt><code><a href="#ltn-dimension"><var>&lt;n-dimension></var></a> ['+' |
4176+
'-'] <a
4177+
href="#ltsignless-integer"><var>&lt;signless-integer></var></a></code>
4178+
4179+
<dt><code>'+'? n ['+' | '-'] <a
4180+
href="#ltsignless-integer"><var>&lt;signless-integer></var></a></code>
4181+
4182+
<dt><code>-n ['+' | '-'] <a
4183+
href="#ltsignless-integer"><var>&lt;signless-integer></var></a></code>
4184+
4185+
<dd> <a href="#a"><var>A</var></a> is the dimension's value, 1, or -1,
4186+
respectively. <a href="#b"><var>B</var></a> is the integer. If a ‘<code
41204187
class=property>-</code>’ was provided between the two, <a
41214188
href="#b"><var>B</var></a> is instead the negation of the integer.
41224189
</dl>
@@ -4321,6 +4388,8 @@ <h2 class=no-num id=index> Index</h2>
43214388
<li>&lt;an+b>, <a href="#anb-production"
43224389
title="section 6.2."><strong>6.2.</strong></a>
43234390

4391+
<li>An+B, <a href="#anb0" title="section 6."><strong>6.</strong></a>
4392+
43244393
<li>are a valid escape, <a
43254394
href="#check-if-two-characters-are-a-valid-esca0"
43264395
title="section 4.5.4."><strong>4.5.4.</strong></a>
@@ -4399,6 +4468,10 @@ <h2 class=no-num id=index> Index</h2>
43994468
<li>current input token, <a href="#current-input-token"
44004469
title="section 5.2."><strong>5.2.</strong></a>
44014470

4471+
<li><code>&lt;dashndashdigit-ident></code>, <a
4472+
href="#ltdashndashdigit-ident"
4473+
title="section 6.2."><strong>6.2.</strong></a>
4474+
44024475
<li>Data state, <a href="#data-state0"
44034476
title="section 4.4.1."><strong>4.4.1.</strong></a>
44044477

@@ -4465,6 +4538,9 @@ <h2 class=no-num id=index> Index</h2>
44654538
href="#ltndashdigit-dimension"
44664539
title="section 6.2."><strong>6.2.</strong></a>
44674540

4541+
<li><code>&lt;ndashdigit-ident></code>, <a href="#ltndashdigit-ident"
4542+
title="section 6.2."><strong>6.2.</strong></a>
4543+
44684544
<li><code>&lt;n-dimension></code>, <a href="#ltn-dimension"
44694545
title="section 6.2."><strong>6.2.</strong></a>
44704546

css-syntax/Overview.src.html

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,7 +2878,7 @@ <h2 id="anb">
28782878
or all elements at regularly-spaced intervals in a list.
28792879

28802880
<p>
2881-
The <var>An+B</var> notation defines an integer step (<dfn>A</dfn>) and offset (<dfn>B</dfn>),
2881+
The <dfn>An+B</dfn> notation defines an integer step (<dfn>A</dfn>) and offset (<dfn>B</dfn>),
28822882
and represents the <var>An+B</var>th elements in a list,
28832883
for every positive integer or zero value of <var>n</var>,
28842884
with the first element in the list having index 1 (not 0).
@@ -2987,27 +2987,41 @@ <h3 id="the-anb-type">
29872987
The <var>An+B</var> notation is defined using a slightly different tokenizer than the rest of CSS,
29882988
resulting in a somewhat odd definition when expressed in terms of CSS tokens.
29892989
This section describes how to recognize the <var>An+B</var> notation in terms of CSS tokens
2990-
(thus defining the <code>&lt;an+b</var> type for CSS grammar purposes),
2990+
(thus defining the <var>&lt;an+b></var> type for CSS grammar purposes),
29912991
and how to interpret the CSS tokens to obtain values for <var>A</var> and <var>B</var>.
29922992

29932993
<p>
2994-
The <dfn id="anb-production">&lt;an+b></dfn> type is defined as:
2994+
The <var>&lt;an+b></var> type is defined as:
29952995

29962996
<pre class='prod'>
29972997
<dfn id="anb-production">&lt;an+b></dfn> =
29982998
odd | even |
2999-
&lt;integer> |
3000-
&lt;n-dimension> |
3001-
&lt;ndashdigit-dimension> |
3002-
&lt;n-dimension> &lt;signed-integer> |
3003-
&lt;n-dimension> ['+' | '-'] &lt;signless-integer></pre>
2999+
<var>&lt;integer></var> |
3000+
3001+
<var>&lt;n-dimension></var> |
3002+
'+'? n |
3003+
-n |
3004+
3005+
<var>&lt;ndashdigit-dimension></var> |
3006+
'+'? <var>&lt;ndashdigit-ident></var> |
3007+
<var>&lt;dashndashdigit-ident></var> |
3008+
3009+
<var>&lt;n-dimension></var> <var>&lt;signed-integer></var> |
3010+
'+'? n <var>&lt;signed-integer></var> |
3011+
-n <var>&lt;signed-integer></var> |
3012+
3013+
<var>&lt;n-dimension></var> ['+' | '-'] <var>&lt;signless-integer></var>
3014+
'+'? n ['+' | '-'] <var>&lt;signless-integer></var> |
3015+
-n ['+' | '-'] <var>&lt;signless-integer></var></pre>
30043016

30053017
<p>
30063018
where:
30073019

30083020
<ul>
30093021
<li><dfn><code>&lt;n-dimension></code></dfn> is a DIMENSION token with its type flag set to "integer", and a unit that is an <i>ASCII case-insensitive</i> match for "n"
30103022
<li><dfn><code>&lt;ndashdigit-dimension></code></dfn> is a DIMENSION token with its type flag set to "integer", and a unit that is an <i>ASCII case-insensitive</i> match for "n-*", where "*" is a series of one or more <i>digits</i>
3023+
<li><dfn><code>&lt;ndashdigit-ident></code></dfn> is an IDENT token whose representation is an <i>ASCII case-insensitive</i> match for "n-*", where "*" is a series of one or more <i>digits</i>
3024+
<li><dfn><code>&lt;dashndashdigit-ident></code></dfn> is an IDENT token whose representation is an <i>ASCII case-insensitive</i> match for "-n-*", where "*" is a series of one or more <i>digits</i>
30113025
<li><dfn><code>&lt;integer></code></dfn> is a NUMBER token with its type flag set to "integer"
30123026
<li><dfn><code>&lt;signed-integer></code></dfn> is a NUMBER token with its type flag set to "integer", and whose representation starts with "+" or "-"
30133027
<li><dfn><code>&lt;signless-integer></code></dfn> is a NUMBER token with its type flag set to "integer", and whose representation start with a <i>digit</i>
@@ -3025,25 +3039,33 @@ <h3 id="the-anb-type">
30253039
<dd>
30263040
<var>A</var> is 2, <var>B</var> is 0.
30273041

3028-
<dt><code>&lt;integer></code>
3042+
<dt><code><var>&lt;integer></var></code>
30293043
<dd>
30303044
<var>A</var> is 0, <var>B</var> is the integer.
30313045

3032-
<dt><code>&lt;n-dimension></code>
3046+
<dt><code><var>&lt;n-dimension></var></code>
3047+
<dt><code>'+'? n</code>
3048+
<dt><code>-n</code>
30333049
<dd>
3034-
<var>A</var> is the dimension's value, <var>B</var> is 0.
3050+
<var>A</var> is the dimension's value, 1, or -1, respectively. <var>B</var> is 0.
30353051

3036-
<dt><code>&lt;ndashdigit-dimension></code>
3052+
<dt><code><var>&lt;ndashdigit-dimension></var></code>
3053+
<dt><code>'+'? <var>&lt;ndashdigit-ident></var></code>
3054+
<dt><code><var>&lt;dashndashdigit-ident></var></code>
30373055
<dd>
3038-
<var>A</var> is the dimension's value, <var>B</var> is the dimension's unit, with the first two characters removed and the remainder interpreted as a base-10 number.
3056+
<var>A</var> is the dimension's value, 1, or -1, respectively. <var>B</var> is the dimension's unit, with the first two characters removed and the remainder interpreted as a base-10 number.
30393057

3040-
<dt><code>&lt;n-dimension> &lt;signed-integer></code>
3058+
<dt><code><var>&lt;n-dimension></var> <var>&lt;signed-integer></var></code>
3059+
<dt><code>'+'? n <var>&lt;signed-integer></var></code>
3060+
<dt><code>-n <var>&lt;signed-integer></var></code>
30413061
<dd>
3042-
<var>A</var> is the dimension's value, <var>B</var> is the integer
3062+
<var>A</var> is the dimension's value, 1, or -1, respectively. <var>B</var> is the integer.
30433063

3044-
<dt><code>&lt;n-dimension> ['+' | '-'] &lt;signless-integer></code>
3064+
<dt><code><var>&lt;n-dimension></var> ['+' | '-'] <var>&lt;signless-integer></var></code>
3065+
<dt><code>'+'? n ['+' | '-'] <var>&lt;signless-integer></var></code>
3066+
<dt><code>-n ['+' | '-'] <var>&lt;signless-integer></var></code>
30453067
<dd>
3046-
<var>A</var> is the dimension's value, <var>B</var> is the integer. If a '-' was provided between the two, <var>B</var> is instead the negation of the integer.
3068+
<var>A</var> is the dimension's value, 1, or -1, respectively. <var>B</var> is the integer. If a '-' was provided between the two, <var>B</var> is instead the negation of the integer.
30473069
</dl>
30483070

30493071

0 commit comments

Comments
 (0)