Skip to content

Commit 4b07a8d

Browse files
committed
[css-lists-3] Add back paragraph on scoping from CSS2, and tie concepts together using it, so that “innermost” is well-defined and also understandable.
1 parent eb94d9a commit 4b07a8d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

css-lists-3/Overview.bs

+15-3
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ Manipulating Counter Values: the 'counter-increment' and 'counter-set' propertie
820820
but only the last set value will take effect.
821821

822822
<h3 id='nested-counters'>
823-
Nested Counters</h3>
823+
Nested Counters and Scope</h3>
824824

825825
Counters are “self-nesting”;
826826
[=instantiating=] a new counter on an element
@@ -834,6 +834,16 @@ Nested Counters</h3>
834834
The ''counter()'' function only retrieves the innermost counter of a given name on the element,
835835
whereas the ''counters()'' function uses all counters of a given name that contain the element.
836836

837+
The <dfn lt="counter scope" local-lt="scope">scope</dfn> of a [=counter=] therefore
838+
starts at the first element in the document that [=instantiates=] that counter
839+
and includes the element’s descendants and its following siblings with their descendants.
840+
However, it does not include any elements in the scope of a counter with the same name
841+
created by a 'counter-reset' on a later sibling of the element,
842+
allowing such explicit counter instantiations
843+
to obscure those earlier siblings.
844+
845+
See [[#creating-counters]] for the exact rules governing the scope of counters and their values.
846+
837847
<div class="example" id='counter-nesting-example'>
838848
The following code numbers nested list items.
839849
The result is very similar to that of setting ''display:list-item'' and ''list-style: inside'' on the LI element:
@@ -895,15 +905,17 @@ Nested Counters</h3>
895905
Creating and Inheriting Counters</h3>
896906

897907
Each element or pseudo-element in a document has
898-
a (possibly empty) set of [=counters=] associated to the element,
908+
a (possibly empty) set of [=counters=] in the [=scope=] of that element,
899909
either through inheritance from another element
900910
or through instantiation on the element directly.
901911
These counters are represented as a <dfn>CSS counters set</dfn>,
902912
which is a [=/set=]
903913
whose values are [=tuples=] of:
904914
a [=string=] (representing a counter’s name),
905915
an element (representing the counter’s originating element),
906-
and an integer (representing the counter’s value).
916+
and an integer (representing the counter’s value),
917+
the latest one of a given name
918+
representing the “innermost” counter of that name.
907919

908920
<div algorithm>
909921
An element [=inherit counters|inherits=] its initial set of counters

0 commit comments

Comments
 (0)