Skip to content

Commit e42f131

Browse files
committed
[css-contain-1] Clarification on scoping counter-set and counter-increment
Closes w3c#1887
1 parent 0995c42 commit e42f131

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

css-contain-1/Overview.bs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,28 @@ Style Containment</h3>
268268
except the scoping element itself is counted as "outside" the tree,
269269
like the rest of the document.
270270

271-
For example, if 'counter-increment' is scoped to an element,
271+
When scoped, the 'counter-set' and 'counter-increment' <a spec=css-lists-3>create a new counter</a>.
272+
273+
<div class=example>
274+
If 'counter-increment' is scoped to an element,
272275
the first use of it within the subtree acts as if the named counter were set to 0 at the scoping element,
273276
regardless of whether the counter had been used outside the scoping element.
274277
Any increments made within the subtree have no effect on counters of the same name outside the scoping element.
278+
Therefore, the following code results in <code>1.2</code> being displayed:
279+
<pre><code highlight=markup>
280+
&lt;div>&lt;/div>
281+
</code></pre>
282+
<pre><code highlight=css>
283+
div {
284+
contain: style;
285+
counter-increment: n;
286+
}
287+
div::before {
288+
counter-increment: n 2;
289+
content: counters(n, '.');
290+
}
291+
</code></pre>
292+
</div>
275293

276294
Possible optimizations that can be enabled by <a>style containment</a> include (but are not limited to):
277295

@@ -412,6 +430,7 @@ This appendix is <em>informative</em>.
412430
<li>Move the interaction between containment and the <code>bookmark-*</code> and <code>string-set</code> properties to [[CSS-CONTENT-3]]
413431
<li>Remove the effects of style containment on the "break-*" properties.
414432
<li>Move the description of the effects of containement on regions from this specification to [[CSS-REGIONS-1]].
433+
<li>Clarify the effects of style scoping on counter-set and counter-increment
415434
</ul>
416435

417436
<h3 id="2017-04-19-changes">Changes from the

css-contain-1/issues-2017-cr.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ <h1>CSS Contain Level 1 Disposition of Comments for 2017-02-21 WD</h1>
8484
Comment: <a href='https://github.com/w3c/csswg-drafts/issues/2223'>https://github.com/w3c/csswg-drafts/issues/2223</a>
8585
Response: <a href='https://github.com/w3c/csswg-drafts/issues/2223#issuecomment-360031684'>https://github.com/w3c/csswg-drafts/issues/2223#issuecomment-360031684</a>
8686
Open</pre>
87+
<pre class='a' id='issue-7'>
88+
Issue 7. <a href='#issue-7'>#</a>
89+
Summary: Do scoped counters create new counters?
90+
From: Oriol Brufau
91+
Comment: <a href='https://github.com/w3c/csswg-drafts/issues/1887'>https://github.com/w3c/csswg-drafts/issues/1887</a>
92+
Response: <a href='https://github.com/w3c/csswg-drafts/issues/1887#issuecomment-342335347'>https://github.com/w3c/csswg-drafts/issues/1887#issuecomment-342335347</a>
93+
Closed: Accepted
94+
Resolved: <a href='https://github.com/w3c/csswg-drafts/issues/1887#issuecomment-342335347'>https://github.com/w3c/csswg-drafts/issues/1887#issuecomment-342335347</a></pre>
8795
<script>
8896
(function () {
8997
var sheet = document.styleSheets[0];

css-contain-1/issues-2017-cr.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,11 @@ From trchen1033
5454
Comment: https://github.com/w3c/csswg-drafts/issues/2223
5555
Response: https://github.com/w3c/csswg-drafts/issues/2223#issuecomment-360031684
5656
Open
57+
----
58+
Issue 7.
59+
Summary: Do scoped counters create new counters?
60+
From: Oriol Brufau
61+
Comment: https://github.com/w3c/csswg-drafts/issues/1887
62+
Response: https://github.com/w3c/csswg-drafts/issues/1887#issuecomment-342335347
63+
Closed: Accepted
64+
Resolved: https://github.com/w3c/csswg-drafts/issues/1887#issuecomment-342335347

0 commit comments

Comments
 (0)