Skip to content

[css-contain] Do scoped counters create new counters? #1887

Closed
@Loirooriol

Description

@Loirooriol

From Style Containment,

For example, if counter-increment is scoped to an element, the first use of it within the subtree acts as if the named counter were set to 0 at the scoping element, regardless of whether the counter had been used outside the scoping element. Any increments made within the subtree have no effect on counters of the same name outside the scoping element.

But it's not much clear if a scoped counter-increment creates a new counter or not.

That is, what is the expected output of

<div></div>
div {
  contain: style;
  counter-increment: n;
}
div::before {
  counter-increment: n 2;
  content: counters(n, '.');
}

Is it 1.2 or just 2?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions