Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-lists] Fix reversed counters to count how many elements increment or set the counter #6297

Merged
merged 2 commits into from
Jun 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion css-lists-3/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,29 @@ Instantiating Counters</h4>

When a [=counter=] is [=instantiated=] without an initial value,
the user agent must dynamically calculate the initial value at layout-time
to be the number of elements and pseudo-elements that [=instantiate=] the same counter in the same [=scope=], plus 1.
to be the value returned by the following algorithm:

1. Let |num| be 0.

2. Let |first| be true.

3. For each element or pseudo-element |el| that increments or
sets the same counter in the same [=scope=]:

1. Let |incrementNegated| be |el|'s 'counter-increment' integer value for this counter,
multiplied by -1.

2. If |first| is true,
then add |incrementNegated| to |num| and
set |first| to false.

3. If |el| sets this counter with 'counter-set',
then add that integer value to |num| and
break this loop.

4. Add |incrementNegated| to |num|.

4. Return |num|.

Note: Only [=reversed=] counters can be instantiated without an initial value.

Expand Down