@@ -1063,13 +1063,29 @@ Counters in elements that do not generate boxes</h3>
10631063<h3 id="list-item-counter">
10641064The Implicit ''list-item'' Counter</h3>
10651065
1066- <a>List items</a> automatically increment
1066+ In addition to any explicitly defined [=counters=]
1067+ that authors write in their styles,
1068+ [=list items=] automatically increment
10671069 a special <dfn value for="counter-increment, counter-set, counter-reset, counter(), counters()">list-item</dfn> <a>counter</a> .
1068- Unless the 'counter-increment' property explicitly specifies
1069- a different increment for the ''list-item'' <a>counter</a> ,
1070- it must be incremented by 1 on every <a>list item</a> ,
1071- at the same time that <a>counters</a> are normally incremented.
1072- (This has no effect on the computed values of the 'counter-*' properties.)
1070+
1071+ By default, the ''list-item'' counter
1072+ must be incremented by 1 on every [=list item=] ,
1073+ exactly as if the [=list item=] had ''list-item 1'' appended to their 'counter-increment' value
1074+ (including side-effects such as possibly [=instantiating=] a new [=counter=] , etc).
1075+ This happens at the same time as when [=counters=] are normally incremented,
1076+ and does not affect the [=specified value|specified=] or [=computed value=] of 'counter-increment' .
1077+
1078+ This automatic increment <strong> does not</strong> happen
1079+ if the [=list item’s=] 'counter-increment'
1080+ explicitly mentions the ''list-item'' counter:
1081+ ''li { counter-increment: list-item 2; }''
1082+ will increment ''list-item'' by 2,
1083+ not by 3 as would happen if you additionally appended ''list-item 1'' to that.
1084+
1085+ Host languages can additionally define more complex behavior
1086+ based on their own semantics.
1087+ For example, HTML lists can have a <{ol/reversed}> attribute,
1088+ which causes the ''list-item'' counter to count <em> down</em> instead on the list items belonging to that element.
10731089
10741090 <div class="example">
10751091 In the following example,
@@ -1085,28 +1101,29 @@ The Implicit ''list-item'' Counter</h3>
10851101 </pre>
10861102 </div>
10871103
1088- Issue: More definition.
1104+ Note: This means that ''counter-increment: none''
1105+ still lets the ''list-item'' counter increment on [=list items=] .
1106+ If one wants to explicitly turn off the ''list-item'' counter as well
1107+ (perhaps because they are doing something more complicated with it themselves),
1108+ one must write ''counter-increment: list-item 0;'' .
1109+
1110+ <!--
10891111 See old <a href="https://github.com/w3c/csswg-drafts/issues/2464#issuecomment-375492907">WG discussions</a>
10901112 and newer <a href="https://github.com/w3c/csswg-drafts/issues/3686">issue discussion</a> .
1091-
1092- UAs and host languages should ensure
1093- that the ''counter-increment/list-item'' counter values
1094- by default
1095- reflect the underlying numeric value dictated by host language semantics
1096- when setting up list item styling
1097- in their UA style sheet and presentational hint style mappings.
1098- <span class="issue"> Not really sure how to word this requirement,
1099- but the following example is expected to work.</span>
1113+ -->
11001114
11011115 <div class="example">
11021116 In the following example,
11031117 the 'content' property is used to create tiered numbering
11041118 that hooks into the ''counter-increment/list-item'' counter,
11051119 and thus respects any numbering changes inflicted through HTML:
1120+
11061121 <pre>
11071122 ol > li::marker { content: counters(list-item,'.' ) '.' ; }
11081123 </pre>
1124+
11091125 Nested lists using this rule would be rendered like
1126+
11101127 <pre>
11111128 1. First top-level item
11121129 5. Second top-level item, value=5
@@ -1119,23 +1136,26 @@ The Implicit ''list-item'' Counter</h3>
11191136 5.5. Third second-level item, list start=3
11201137 6. Third top-level item
11211138 </pre>
1139+
11221140 given markup such as
1141+
11231142 <xmp>
1124- <ol>
1125- <li> First top-level item
1126- <li value=5> Second top-level item, value=5
1127- <ol start=3>
1128- <li> First second-level item, list start=3
1129- <li> Second second-level item, list start=3
1130- <ol reversed>
1131- <li> First third-level item in reversed list
1132- <li> Second third-level item in reversed list
1133- <li> Third third-level item in reversed list
1134- <li> Fourth third-level item in reversed list
1135- </ol>
1136- <li> Third second-level item, list start=3
1137- <li> Third top-level item
1138- </ol>
1143+ <ol>
1144+ <li> First top-level item
1145+ <li value=5> Second top-level item, value=5
1146+ <ol start=3>
1147+ <li> First second-level item, list start=3
1148+ <li> Second second-level item, list start=3
1149+ <ol reversed>
1150+ <li> First third-level item in reversed list
1151+ <li> Second third-level item in reversed list
1152+ <li> Third third-level item in reversed list
1153+ <li> Fourth third-level item in reversed list
1154+ </ol>
1155+ </ol>
1156+ <li> Third second-level item, list start=3
1157+ <li> Third top-level item
1158+ </ol>
11391159 </xmp>
11401160 </div>
11411161
0 commit comments