Skip to content

Commit 656d63d

Browse files
committed
[css-contain] Clarify behavior of style contaiment on counters
Closes w3c#2483
1 parent b73d7dc commit 656d63d

3 files changed

Lines changed: 29 additions & 9 deletions

File tree

css-contain-1/Overview.bs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Link Defaults: css-lists-3 (property) counter-increment
1919
spec: css2; urlPrefix: https://www.w3.org/TR/CSS2/
2020
type: property; url: generate.html#propdef-content; text: content
2121
type: value; for: content; url: generate.html#value-def-open-quote; text: open-quote
22+
type: value; for: content; url: generate.html#value-def-close-quote; text: close-quote
23+
type: value; for: content; url: generate.html#value-def-no-open-quote; text: no-open-quote
24+
type: value; for: content; url: generate.html#value-def-no-close-quote; text: no-close-quote
2225
type: dfn; url: box.html#padding-edge; text: padding edge
2326

2427
spec: css-backgrounds-3;
@@ -268,9 +271,19 @@ Style Containment</h3>
268271

269272
Giving an element <dfn export>style containment</dfn> has the following effect:
270273

271-
1. The 'counter-increment', 'counter-set', and <a property spec=css2>content</a> (for the purpose of ''content/open-quote''/etc values) properties
274+
1. The 'counter-increment' and 'counter-set' properties
275+
must be <a for=property>scoped</a> to the element's sub-tree
276+
and create a new counter.
277+
278+
2. The effects of the 'content' property's
279+
''content/open-quote'', ''content/close-quote'', ''content/no-open-quote'' and ''content/no-close-quote''
272280
must be <a for=property>scoped</a> to the element's sub-tree.
273281

282+
Note: This implies that the depth of quote nesting in the subtree
283+
is unchanged and starts at the value that its context normally implies,
284+
but that changes to the depth of quote nesting by these values inside the subtree
285+
do not affect the depth of quote nesting outside the subtree.
286+
274287
Note: [[CSS-REGIONS-1]] has normative requirements on how <a>style containment</a> affects regions.
275288

276289
A <dfn export for=property lt="scoped | scoped property | scoped properties">scoped property</dfn> has its effects scoped to a particular element or subtree.
@@ -289,22 +302,26 @@ Style Containment</h3>
289302
When scoped, the 'counter-set' and 'counter-increment' <a spec=css-lists-3>create a new counter</a>.
290303

291304
<div class=example>
292-
If 'counter-increment' is scoped to an element's subtree,
305+
As 'counter-increment' is scoped to an element's subtree,
293306
the first use of it within the subtree acts as if the named counter were set to 0 at the scoping element,
294307
regardless of whether the counter had been used outside the scoping element.
295308
Any increments made within the subtree have no effect on counters of the same name outside the scoping element.
296-
Therefore, the following code results in <code>1.2</code> being displayed:
309+
However, the ''content/counter()'' and ''content/counters()'' value of the 'content' property is not itself scoped,
310+
and can refer to counters established outside of the subtree.
311+
Therefore, the following code results in <q><samp>1 1.2</samp></q> being displayed:
297312
<pre><code highlight=markup>
298313
&lt;div>&lt;/div>
299314
</code></pre>
300315
<pre><code highlight=css>
301316
div {
302317
contain: style;
303-
counter-increment: n;
318+
counter-increment: n;
319+
}
320+
div::before, div::after {
321+
content: counters(n, '.') " ";
304322
}
305-
div::before {
323+
div::after {
306324
counter-increment: n 2;
307-
content: counters(n, '.');
308325
}
309326
</code></pre>
310327
</div>
@@ -457,6 +474,7 @@ This appendix is <em>informative</em>.
457474
<li>Elements with size containment are monolithic
458475
<li>Forced breaks area allowed in elements with layout containments, but do not propagate
459476
<li>Clarify the effects of scoping to a subtree
477+
<li>Clarify the effects of scoping on counters
460478
</ul>
461479

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

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,15 @@ <h1>CSS Contain Level 1 Disposition of Comments for 2017-02-21 WD</h1>
9797
Response: <a href='https://github.com/w3c/csswg-drafts/issues/1887#issuecomment-342335347'>https://github.com/w3c/csswg-drafts/issues/1887#issuecomment-342335347</a>
9898
Closed: Accepted
9999
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>
100-
<pre class=' open' id='issue-8'>
100+
<pre class='a' id='issue-8'>
101101
Issue 8. <a href='#issue-8'>#</a>
102102
Summary: Scoping of the content property unclear
103103
From: Oriol Brufau
104104
Comment: <a href='https://github.com/w3c/csswg-drafts/issues/2483'>https://github.com/w3c/csswg-drafts/issues/2483</a>
105105
Comment: <a href='https://github.com/w3c/csswg-drafts/issues/2483#issuecomment-377214307'>https://github.com/w3c/csswg-drafts/issues/2483#issuecomment-377214307</a>
106106
Response: <a href='https://github.com/w3c/csswg-drafts/issues/2483#issuecomment-379124749'>https://github.com/w3c/csswg-drafts/issues/2483#issuecomment-379124749</a>
107-
Open</pre>
107+
Closed: Accepted
108+
Resolved: <a href='https://github.com/w3c/csswg-drafts/issues/2483#issuecomment-380360855'>https://github.com/w3c/csswg-drafts/issues/2483#issuecomment-380360855</a></pre>
108109
<pre class='a' id='issue-9'>
109110
Issue 9. <a href='#issue-9'>#</a>
110111
Summary: Clarify style containment property scopment

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ From: Oriol Brufau
7474
Comment: https://github.com/w3c/csswg-drafts/issues/2483
7575
Comment: https://github.com/w3c/csswg-drafts/issues/2483#issuecomment-377214307
7676
Response: https://github.com/w3c/csswg-drafts/issues/2483#issuecomment-379124749
77-
Open
77+
Closed: Accepted
78+
Resolved: https://github.com/w3c/csswg-drafts/issues/2483#issuecomment-380360855
7879
----
7980
Issue 9.
8081
Summary: Clarify style containment property scopment

0 commit comments

Comments
 (0)