You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li><ahref=#inheritance0><spanclass=secno>4.1</span> Inheritance and Shadow DOM</a></ul>
120
120
<li><ahref=#inheritance><spanclass=secno>5</span> Shadow DOM Combinators</a>
121
121
<ulclass=toc>
122
-
<li><ahref=#shadow-deep-combinator><spanclass=secno>5.1</span> Selecting Through All Shadows: the <spanclass=cssdata-link-type=maybetitle=/shadow-deep/>/shadow-deep/</span> combinator</a>
123
-
<li><ahref=#content-combinator><spanclass=secno>5.2</span> Selecting Distributed Elements: the <spanclass=cssdata-link-type=maybetitle=/content/>/content/</span> combinator</a></ul>
122
+
<li><ahref=#shadow-deep-combinator><spanclass=secno>5.1</span> Selecting Through All Shadows: the <spanclass=cssdata-link-type=maybetitle=/shadow-deep/>/shadow-deep/</span> combinator</a></ul>
124
123
<li><ahref=#selectors><spanclass=secno>6</span> Shadow DOM Selectors</a>
125
124
<ulclass=toc>
126
125
<li><ahref=#host-selector><spanclass=secno>6.1</span> Selecting the Host Element: the <spanclass=cssdata-link-type=maybetitle=:host>:host</span> and <spanclass=cssdata-link-type=maybetitle=:host()>:host()</span> pseudo-classes</a>
127
126
<li><ahref=#ancestor-selector><spanclass=secno>6.2</span> Selecting Based on an Ancestor Outside the Shadow Tree: the <spanclass=cssdata-link-type=maybetitle=:host-context()>:host-context()</span> pseudo-class</a>
128
-
<li><ahref=#shadow-pseudoelement><spanclass=secno>6.3</span> Selecting the Shadow Root Itself: the <spanclass=cssdata-link-type=maybetitle=::shadow>::shadow</span> pseudo-element</a></ul>
127
+
<li><ahref=#shadow-pseudoelement><spanclass=secno>6.3</span> Selecting the Shadow Root Itself: the <spanclass=cssdata-link-type=maybetitle=::shadow>::shadow</span> pseudo-element</a>
128
+
<li><ahref=#content-combinator><spanclass=secno>6.4</span> Selecting Distributed Elements: the <spanclass=cssdata-link-type=maybetitle=::content>::content</span> pseudo-element</a></ul>
Selecting Distributed Elements: the <aclass=cssdata-link-type=maybehref=#selectordef-contenttitle=/content/>/content/</a> combinator</span><aclass=self-linkhref=#content-combinator></a></h3>
353
-
354
-
<p> When a <dfnclass=css-codedata-dfn-type=selectordata-export="" id=selectordef-content>/content/<aclass=self-linkhref=#selectordef-content></a></dfn> combinator is encountered in a selector,
355
-
first filter the <adata-link-type=dfnhref=http://dev.w3.org/csswg/selectors-4/#selector-match-listtitle="selector match list">selector match list</a> to only include elements with <adata-link-type=dfnhref=#distribution-listtitle="distribution lists">distribution lists</a>.
356
-
Then replace every element in the <adata-link-type=dfnhref=http://dev.w3.org/csswg/selectors-4/#selector-match-listtitle="selector match list">selector match list</a>
357
-
with the elements in the <adata-link-type=dfnhref=#distribution-listtitle="distribution list">distribution list</a> of each element.
358
-
359
-
<divclass=example>
360
-
For example, say you had a component with both children and a shadow tree,
Selecting Distributed Elements: the <aclass=cssdata-link-type=maybehref=#selectordef-contenttitle=::content>::content</a> pseudo-element</span><aclass=self-linkhref=#content-combinator></a></h3>
485
+
486
+
<p> The <dfnclass=css-codedata-dfn-type=selectordata-export="" id=selectordef-content>::content<aclass=self-linkhref=#selectordef-content></a></dfn> pseudo-element matches the <adata-link-type=dfnhref=#distribution-listtitle="distribution list">distribution list</a> itself,
487
+
on elements that have one.
488
+
489
+
<p> The <aclass=cssdata-link-type=maybehref=#selectordef-contenttitle=::content>::content</a> pseudo-element must not generate boxes,
490
+
unless specified otherwise in another specification.
491
+
However, for the purpose of Selectors,
492
+
the <aclass=cssdata-link-type=maybehref=#selectordef-contenttitle=::content>::content</a> pseudo-element is considered to be the parent of the elements in the <adata-link-type=dfnhref=#distribution-listtitle="distribution list">distribution list</a>.
493
+
494
+
<divclass=example>
495
+
For example, say you had a component with both children and a shadow tree,
496
+
like the following:
497
+
498
+
<pre> <x-foo>
499
+
<div id="one" class="foo">...</div>
500
+
<div id="two">...</div>
501
+
<div id="three" class="foo">
502
+
<div id="four">...</div>
503
+
</div>
504
+
<"shadow tree">
505
+
<div id="five">...</div>
506
+
<div id="six">...</div>
507
+
<content select=".foo"></content>
508
+
</"shadow tree">
509
+
</x-foo>
510
+
</pre>
511
+
<p> For a stylesheet within the <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a>,
512
+
a selector like <spanclass=cssdata-link-type=maybetitle="::content div">::content div</span>
513
+
selects <spanclass=cssdata-link-type=maybetitle=#one>#one</span>, <spanclass=cssdata-link-type=maybetitle=#three>#three</span>, and <spanclass=cssdata-link-type=maybetitle=#four>#four</span>,
514
+
as they’re the elements distributed by the sole <adata-link-type=elementtitle=content>content</a> element,
515
+
but not <spanclass=cssdata-link-type=maybetitle=#two>#two</span>.
516
+
517
+
<p> If only the <adata-link-type=dfnhref=#top-level-elementtitle="top-level elements">top-level elements</a> distributed the <adata-link-type=elementtitle=content>content</a> element are desired,
518
+
a <adata-link-type=dfnhref=http://dev.w3.org/csswg/selectors-4/#child-combinatortitle="child combinator">child combinator</a> can be used,
519
+
like <spanclass=cssdata-link-type=maybetitle="::content > div">::content > div</span>,
520
+
which will exclude <spanclass=cssdata-link-type=maybetitle=#four>#four</span>
521
+
as it’s not treated as a child of the <aclass=cssdata-link-type=maybehref=#selectordef-contenttitle=::content>::content</a> pseudo-element.
522
+
523
+
<pclass=note> Note: Note that a selector like <spanclass=cssdata-link-type=maybetitle="::content div">::content div</span>
524
+
is equivalent to <spanclass=cssdata-link-type=maybetitle="*::content div">*::content div</span>,
525
+
where the <spanclass=cssdata-link-type=maybetitle=*>*</span> selects many more elements that just the <adata-link-type=elementtitle=content>content</a> element.
526
+
However, since only the <adata-link-type=elementtitle=content>content</a> element has a <adata-link-type=dfnhref=#distribution-listtitle="distribution list">distribution list</a>,
527
+
it’s the only element that has a <aclass=cssdata-link-type=maybehref=#selectordef-contenttitle=::content>::content</a> pseudo-element as well.
0 commit comments