Skip to content

Commit 7f2f64b

Browse files
committed
[css-shadow-parts] Add support for multiple names in ::part(), as discussed with Fergal.
1 parent 64f3294 commit 7f2f64b

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

css-shadow-parts-1/Overview.bs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,13 @@ allows you to select elements that have been exposed via a <{html-global/part}>
249249
The syntax is:
250250

251251
<pre class=prod>
252-
::part() = ::part( <<ident>> )
252+
::part() = ::part( <<ident>>+ )
253253
</pre>
254254

255255
The ''::part()'' pseudo-element only matches anything
256256
when the <a>originating element</a> is a <a>shadow host</a>.
257257
If the <a>originating element's</a> <a>shadow root's</a> <a>part element map</a>
258-
[=map/contains=] the specified <<ident>>,
258+
[=map/contains=] all of the specified <<ident>>s,
259259
''::part()'' matches the element or elements keyed to that <<ident>>.
260260
Otherwise, it matches nothing.
261261

@@ -268,15 +268,30 @@ Otherwise, it matches nothing.
268268
''#the-button::part(label)''.
269269
</div>
270270

271-
The <a>shadow-part pseudo-elements</a> can take additional pseudo-classes after them,
271+
<div class="example">
272+
Part names act similarly to classes:
273+
multiple elements can have the same part name,
274+
and a single element can have multiple part names.
275+
276+
A tabstrip control might have multiple elements
277+
with <code>part="tab"</code>,
278+
all of which are selected by ''::part(tab)''.
279+
280+
If a single tab is active at a time,
281+
it can be specially indicated with <code>part="tab active"</code>
282+
and then selected by ''::part(tab active)''
283+
(or ''::part(active tab)'', as order doesn't matter).
284+
</div>
285+
286+
The ''::part()'' pseudo-element can take additional pseudo-classes after it,
272287
such as ''x-button::part(label):hover'',
273-
but never match the <a>structural pseudo-classes</a>
288+
but never matches the <a>structural pseudo-classes</a>
274289
or any other pseudo-classes that match based on tree information
275290
rather than local element information.
276291

277-
The <a>shadow-part pseudo-elements</a> also can take additional pseudo-elements after them,
292+
The ''::part()'' pseudo-element can also take additional pseudo-elements after it,
278293
such as ''x-button::part(label)::before'',
279-
but never match additional <a>shadow-part pseudo-elements</a>.
294+
but never match additional ''::part()''s.
280295

281296
<div class=example>
282297
For example,

0 commit comments

Comments
 (0)