Skip to content

Commit f0cf823

Browse files
committed
Made 'range' accept multiple ranges (useful for complex additive styles)
1 parent 53a98d6 commit f0cf823

2 files changed

Lines changed: 36 additions & 46 deletions

File tree

css3-lists/Overview.html

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,9 +1405,8 @@ <h2 id=counter-style><span class=secno>8. </span> Defining Custom Counter
14051405
<li>a <dfn id=suffix title=counter-suffix>suffix</dfn>, to append to the
14061406
representation
14071407

1408-
<li>an <dfn id=upper title=counter-upper-bound>upper</dfn> and <dfn
1409-
id=lower-range-bound title=counter-lower-bound>lower range bound</dfn>,
1410-
to specify the (inclusive) range that the counter style can handle
1408+
<li>a <dfn id=range title=counter-range>range</dfn>, which limits the
1409+
values that a counter style can handle
14111410

14121411
<li>and a <dfn id=fallback-style title=counter-fallback>fallback
14131412
style</dfn>, to render the representation with when the counter value is
@@ -1429,12 +1428,12 @@ <h2 id=counter-style><span class=secno>8. </span> Defining Custom Counter
14291428
counter value, follow these steps:
14301429

14311430
<ol>
1432-
<li>If the counter value is less than the <a href="#lower-range-bound"><i
1433-
title=counter-lower-bound>lower bound</i></a> or greater than the <a
1434-
href="#upper"><i title=counter-upper-bound>upper bound</i></a> of the
1435-
counter style, exit this algorithm and instead <i
1436-
title=generate-a-counter>generate a counter representation</i> using the
1437-
counter style's fallback style and the same counter value.
1431+
<li>If the counter value is less than the <i
1432+
title=counter-lower-bound>lower bound</i> or greater than the <i
1433+
title=counter-upper-bound>upper bound</i> of the counter style, exit this
1434+
algorithm and instead <i title=generate-a-counter>generate a counter
1435+
representation</i> using the counter style's fallback style and the same
1436+
counter value.
14381437

14391438
<li>Using the counter value and the <a href="#algorithm"><i
14401439
title=counter-algorithm>counter algorithm</i></a> for the counter style,
@@ -2114,7 +2113,7 @@ <h3 id=counter-style-range><span class=secno>8.5. </span> Limiting the
21142113
<tr>
21152114
<th>Value:
21162115

2117-
<td>[ &lt;integer> | infinite ]{2} | auto
2116+
<td>[ [ &lt;integer> | infinite ]{2} ]# | auto
21182117

21192118
<tr>
21202119
<th>Initial:
@@ -2123,19 +2122,21 @@ <h3 id=counter-style-range><span class=secno>8.5. </span> Limiting the
21232122
</table>
21242123

21252124
<p>The &lsquo;<a href="#descdef-range"><code
2126-
class=property>range</code></a>&rsquo; descriptor defines the range over
2125+
class=property>range</code></a>&rsquo; descriptor defines the ranges over
21272126
which the counter style is defined. If a counter style is used to
2128-
represent a counter value outside of its range, the counter style instead
2127+
represent a counter value outside of its ranges, the counter style instead
21292128
drops down to its fallback counter style.
21302129

21312130
<p>If the value is not &lsquo;<code class=css>auto</code>&rsquo;, the first
2132-
value represents the lower bound of the range (with &lsquo;<code
2133-
class=property>infinite</code>&rsquo; representing negative infinity), and
2134-
the second value represents the upper bound of the range (with
2135-
&lsquo;<code class=property>infinite</code>&rsquo; representing positive
2136-
infinity). This is an inclusive range - it includes both the lower and
2137-
upper bound numbers. If the lower bound is higher than the higher bound,
2138-
the descriptor is invalid and must be ignored.
2131+
value of each range in the list represents the lower bound of the range
2132+
(with &lsquo;<code class=css>infinite</code>&rsquo; representing negative
2133+
infinity), and the second value represents the upper bound of the range
2134+
(with &lsquo;<code class=property>infinite</code>&rsquo; representing
2135+
positive infinity). This is an inclusive range - it includes both the
2136+
lower and upper bound numbers. The range of the counter style as a whole
2137+
is the union of the individual ranges. If the lower bound of any range is
2138+
higher than the higher bound, the entire descriptor is invalid and must be
2139+
ignored.
21392140

21402141
<p>If the value is &lsquo;<code class=css>auto</code>&rsquo;, the range
21412142
depends on the counter type. For &lsquo;<code
@@ -2335,14 +2336,13 @@ <h2 id=symbols-function><span class=secno>9. </span> Defining Anonymous
23352336
counter style with no <a href="#name"><i title=counter-name>name</i></a>,
23362337
a <a href="#prefix"><i title=counter-prefix>prefix</i></a> and <a
23372338
href="#suffix"><i title=counter-suffix>suffix</i></a> of &lsquo;<code
2338-
class=css>""</code>&rsquo; (the empty string), a <a
2339-
href="#lower-range-bound"><i title=counter-lower-bound>lower bound</i></a>
2340-
of negative infinity, an <a href="#upper"><i
2341-
title=counter-upper-bound>upper bound</i></a> of infinity, an <a
2342-
href="#fallback-style"><i title=counter-fallback>fallback style</i></a> of
2343-
&lsquo;<a href="#decimal"><code class=css>decimal</code></a>&rsquo;, and a
2344-
<a href="#negative-sign"><i title=counter-negative>negative sign</i></a>
2345-
of "\2D" ("-" hyphen-minus). The counter style's <a href="#algorithm"><i
2339+
class=css>""</code>&rsquo; (the empty string), a <a href="#range"><i
2340+
title=counter-range>range</i></a> from negative infinity to positive
2341+
infinity, an <a href="#fallback-style"><i title=counter-fallback>fallback
2342+
style</i></a> of &lsquo;<a href="#decimal"><code
2343+
class=css>decimal</code></a>&rsquo;, and a <a href="#negative-sign"><i
2344+
title=counter-negative>negative sign</i></a> of "\2D" ("-" hyphen-minus).
2345+
The counter style's <a href="#algorithm"><i
23462346
title=counter-algorithm>algorithm</i></a> is constructed by consulting the
23472347
previous chapter using the provided type - or &lsquo;<code
23482348
class=css>symbolic</code>&rsquo; if the type was omitted - and the
@@ -2896,9 +2896,6 @@ <h2 class=no-num id=index>Index</h2>
28962896
<li>counter-fallback, <a href="#fallback-style"
28972897
title=counter-fallback><strong>8.</strong></a>
28982898

2899-
<li>counter-lower-bound, <a href="#lower-range-bound"
2900-
title=counter-lower-bound><strong>8.</strong></a>
2901-
29022899
<li>counter-name, <a href="#name"
29032900
title=counter-name><strong>8.</strong></a>
29042901

@@ -2908,6 +2905,9 @@ <h2 class=no-num id=index>Index</h2>
29082905
<li>counter-prefix, <a href="#prefix"
29092906
title=counter-prefix><strong>8.</strong></a>
29102907

2908+
<li>counter-range, <a href="#range"
2909+
title=counter-range><strong>8.</strong></a>
2910+
29112911
<li>&lt;counter-style>, <a href="#ltcounter-style"
29122912
title="&lt;counter-style>"><strong>3.</strong></a>
29132913

@@ -2920,9 +2920,6 @@ <h2 class=no-num id=index>Index</h2>
29202920
<li>counter symbol, <a href="#counter-symbol"
29212921
title="counter symbol"><strong>8.7.</strong></a>
29222922

2923-
<li>counter-upper-bound, <a href="#upper"
2924-
title=counter-upper-bound><strong>8.</strong></a>
2925-
29262923
<li>current tuple, <a href="#current-tuple"
29272924
title="current tuple"><strong>8.1.6.</strong></a>
29282925

css3-lists/Overview.src.html

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,7 @@ <h2 id='counter-style'>
846846

847847
<li>a <dfn title='counter-suffix'>suffix</dfn>, to append to the representation</li>
848848

849-
<li>an <dfn title='counter-upper-bound'>upper</dfn> and
850-
<dfn title='counter-lower-bound'>lower range bound</dfn>, to specify the
851-
(inclusive) range that the counter style can handle</li>
849+
<li>a <dfn title='counter-range'>range</dfn>, which limits the values that a counter style can handle</li>
852850

853851
<li>and a <dfn title='counter-fallback'>fallback style</dfn>, to render the
854852
representation with when the counter value is outside the counter style's
@@ -1422,22 +1420,17 @@ <h3 id='counter-style-range'>
14221420
<td><dfn id="descdef-range">range</dfn>
14231421
<tr>
14241422
<th>Value:
1425-
<td>[ &lt;integer> | infinite ]{2} | auto
1423+
<td>[ [ &lt;integer> | infinite ]{2} ]# | auto
14261424
<tr>
14271425
<th>Initial:
14281426
<td>auto
14291427
</table>
14301428

1431-
<p>The 'range' descriptor defines the range over which the counter style is defined.
1432-
If a counter style is used to represent a counter value outside of its range,
1429+
<p>The 'range' descriptor defines the ranges over which the counter style is defined.
1430+
If a counter style is used to represent a counter value outside of its ranges,
14331431
the counter style instead drops down to its fallback counter style.</p>
14341432

1435-
<p>If the value is not ''auto'', the first value represents the lower bound of the range (with 'infinite'
1436-
representing negative infinity), and the second value represents the upper bound
1437-
of the range (with 'infinite' representing positive infinity). This is an inclusive
1438-
range - it includes both the lower and upper bound numbers. If the lower
1439-
bound is higher than the higher bound, the descriptor is invalid and must
1440-
be ignored.</p>
1433+
<p>If the value is not ''auto'', the first value of each range in the list represents the lower bound of the range (with ''infinite'' representing negative infinity), and the second value represents the upper bound of the range (with 'infinite' representing positive infinity). This is an inclusive range - it includes both the lower and upper bound numbers. The range of the counter style as a whole is the union of the individual ranges. If the lower bound of any range is higher than the higher bound, the entire descriptor is invalid and must be ignored.</p>
14411434

14421435
<p>If the value is ''auto'', the range depends on the counter type. For ''repeating'', ''numeric'', and ''non-repeating'' types, it must be treated identically to specifying ''infinite infinite''. For ''alphabetic'' and ''symbolic'', it must be treated identically to ''1 infinite''. For ''additive'', it must be treated identically to ''0 infinite''. For ''override'', it must be treated according to the type of the counter style it is overriding.</p>
14431436

@@ -1556,7 +1549,7 @@ <h2 id='symbols-function'>
15561549

15571550
<p>Where &lt;type> is one of the following keywords: ''repeating'', ''numeric'', ''alphabetic'', ''symbolic'', or ''non-repeating''.</p>
15581551

1559-
<p>The ''symbols()'' function defines an anonymous counter style with no <i title="counter-name">name</i>, a <i title="counter-prefix">prefix</i> and <i title="counter-suffix">suffix</i> of ''""'' (the empty string), a <i title="counter-lower-bound">lower bound</i> of negative infinity, an <i title="counter-upper-bound">upper bound</i> of infinity, an <i title="counter-fallback">fallback style</i> of ''decimal'', and a <i title="counter-negative">negative sign</i> of "\2D" ("-" hyphen-minus). The counter style's <i title="counter-algorithm">algorithm</i> is constructed by consulting the previous chapter using the provided type - or ''symbolic'' if the type was omitted - and the provided &lt;string>s and &lt;image>s as the value of the 'symbols' property. If the type is ''non-repeating'', the <i>first symbol value</i> is ''1''.</p>
1552+
<p>The ''symbols()'' function defines an anonymous counter style with no <i title="counter-name">name</i>, a <i title="counter-prefix">prefix</i> and <i title="counter-suffix">suffix</i> of ''""'' (the empty string), a <i title="counter-range">range</i> from negative infinity to positive infinity, an <i title="counter-fallback">fallback style</i> of ''decimal'', and a <i title="counter-negative">negative sign</i> of "\2D" ("-" hyphen-minus). The counter style's <i title="counter-algorithm">algorithm</i> is constructed by consulting the previous chapter using the provided type - or ''symbolic'' if the type was omitted - and the provided &lt;string>s and &lt;image>s as the value of the 'symbols' property. If the type is ''non-repeating'', the <i>first symbol value</i> is ''1''.</p>
15601553

15611554
<div class='example'>
15621555
<p>This code:</p>

0 commit comments

Comments
 (0)