Re: [csswg-drafts] [css-contain] style containment counter scoping clarification (#5175)

I'm reopening this because https://drafts.csswg.org/css-contain/#containment-style has an example that says

> As [`counter-increment`](https://drafts.csswg.org/css2/#propdef-counter-increment) is scoped to an element’s subtree, the first use of it within the subtree acts as if the named counter were set to 0 **at the scoping element**

But I agree with changing that, since in

```html
<style>
.contained { contain: style }
.reset { counter-reset: n 10 }
.increment::before { counter-increment: n }
.report::before { content: counters(n, ".") }
</style>
<div class="contained reset">
  <div class="report"></div>
  <div class="increment report"></div>
  <div class="increment report"></div>
</div>
```

The 1st item is not modifying counters so it's supposed to read `10`.
The 2nd item increments, so it instantiates a new counter and produces `10.1`
But if this new counter is instantiated at the beginning of the scoping element, then we would have to go back to the 1st item and update it to `10.0`!
So better instantiate the counter locally, then the result is

```
10
10.1
10.1
```

Also, a note is not normative. All of this needs to be properly defined in normative text.

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5175#issuecomment-1380898285 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 12 January 2023 19:21:19 UTC