@@ -815,7 +815,7 @@ Nested Counters and Scope</h3>
815
815
This is important for situations like lists in HTML,
816
816
where lists can be nested inside lists to arbitrary depth:
817
817
it would be impossible to define uniquely named counters for each level.
818
- The ''counter()'' function only retrieves the innermost counter of a given name on the element,
818
+ The ''counter()'' function only retrieves the [= innermost=] counter of a given name on the element,
819
819
whereas the ''counters()'' function uses all counters of a given name that contain the element.
820
820
821
821
The <dfn lt="counter scope" local-lt="scope">scope</dfn> of a [=counter=] therefore
@@ -899,7 +899,7 @@ Creating and Inheriting Counters</h3>
899
899
an element (representing the counter’s originating element),
900
900
and an integer (representing the counter’s value).
901
901
The latest [=counter=] of a given name in that set
902
- represents the “ innermost” counter of that name.
902
+ represents the <dfn> innermost</dfn> counter of that name.
903
903
904
904
<h4 id="inheriting-counters">
905
905
Inheriting Counters</h4>
@@ -1147,34 +1147,47 @@ The Implicit ''list-item'' Counter</h3>
1147
1147
<h3 id='counter-functions'>
1148
1148
Outputting Counters: the ''counter()'' and ''counters()'' functions</h3>
1149
1149
1150
- Counters have no visible effect by themselves,
1150
+ [= Counters=] have no visible effect by themselves,
1151
1151
but their values can be used
1152
1152
with the ''counter()'' and ''counters()'' functions,
1153
- which represent the counter values as strings or images.
1154
- Their syntax is :
1153
+ whose [=used values=] represent counter values as strings or images.
1154
+ They are defined as follows :
1155
1155
1156
1156
<pre>
1157
1157
<dfn><<counter>></dfn> = <<counter()>> | <<counters()>>
1158
- <dfn>counter()</dfn> = counter( <<counter-name>> , [ <<counter-style>> | none ] ? )
1159
- <dfn>counters()</dfn> = counters( <<counter-name>> , <<string>> , [ <<counter-style>> | none ] ? )
1158
+ <dfn>counter()</dfn> = counter( <<counter-name>> , <<counter-style>> ? )
1159
+ <dfn>counters()</dfn> = counters( <<counter-name>> , <<string>> , <<counter-style>> ? )
1160
1160
</pre>
1161
1161
1162
- For both functions, the first argument represents the name of a counter,
1163
- and if the last argument is omitted it defaults to ''decimal'' .
1162
+ where <<counter-style>> specifies the [=counter style=]
1163
+ for <a lt="generate a counter representation">generating a representation</a>
1164
+ of the named counter(s)
1165
+ as defined in [[!css-counter-styles-3]] and
1164
1166
1165
- The used value of ''counter()'' is obtained as follows:
1167
+ <dl>
1168
+ <dt> counter()
1169
+ <dd>
1170
+ Represents the value of the [=innermost=] [=counter=]
1171
+ in the element’s [=CSS counters set=]
1172
+ named <<counter-name>>
1173
+ using the [=counter style=] named <<counter-style>> .
1166
1174
1167
- <ul>
1168
- <li>
1169
- If the second argument to the function is <css> none</css> ,
1170
- the function represents the empty string.
1171
-
1172
- <li>
1173
- Otherwise, the function represents the string returned when one <a lt="generate a counter representation">generates a counter representation</a>
1174
- for the value of the innermost counter of that name on the element
1175
- (or ''0'' if the element has no counter of that name)
1176
- using the <<counter-style>> specified by the second argument.
1177
- </ul>
1175
+ <dt> counters()
1176
+ <dd>
1177
+ Represents the values of all the [=counters=]
1178
+ in the element’s [=CSS counters set=]
1179
+ named <<counter-name>>
1180
+ using the [=counter style=] named <<counter-style>> ,
1181
+ sorted in outermost-first to [=innermost=] -last order
1182
+ and joined by the specified <<string>> .
1183
+ </dl>
1184
+
1185
+ In both cases,
1186
+ if the <<counter-style>> argument is omitted it defaults to ''decimal'' .
1187
+
1188
+ If no [=counter=] named <<counter-name>> exists
1189
+ on an element where ''counter()'' or ''counters()'' is used,
1190
+ one is first [=instantiated=] with a starting value of ''0'' .
1178
1191
1179
1192
<div class="example">
1180
1193
<pre>
@@ -1195,37 +1208,6 @@ Outputting Counters: the ''counter()'' and ''counters()'' functions</h3>
1195
1208
</pre>
1196
1209
</div>
1197
1210
1198
- The used value of ''counters()'' is obtained as follows:
1199
-
1200
- <ul>
1201
- <li>
1202
- If the third argument to the function is <css> none</css> ,
1203
- the function represents the empty string.
1204
-
1205
- <li>
1206
- Otherwise, if the element has no counters of that name,
1207
- the function represents the string returned when one <a lt="generate a counter representation">generates a counter representation</a>
1208
- for ''0''
1209
- using the <<counter-style>> specified by the third argument.
1210
-
1211
- <li>
1212
- Otherwise, if the element has a single counter of that name,
1213
- the function represents the string returned when one <a lt="generate a counter representation">generates a counter representation</a>
1214
- for that counter's value
1215
- using the <<counter-style>> specified by the third argument.
1216
-
1217
- <li>
1218
- Otherwise,
1219
- <a>generate a counter representation</a>
1220
- for the values of all counters of the given name on the element
1221
- using the <<counter-style>> specified by the third argument.
1222
- Sort the resulting strings by the nesting depth of the counters they were generated from,
1223
- with the outermost counter first and the innermost last.
1224
- Join the list into a single string,
1225
- inserting the <<string>> specified by the second argument between each item in the list.
1226
- The function represents the string thus produced.
1227
- </ul>
1228
-
1229
1211
<div class='example'>
1230
1212
The following example shows a simple use of the ''counters()'' function:
1231
1213
0 commit comments