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-combinator><spanclass=secno>5.1</span> Selecting Into A Shadow Tree: the <spanclass=cssdata-link-type=maybetitle=/shadow/>/shadow/</span> combinator</a>
123
-
<li><ahref=#shadow-deep-combinator><spanclass=secno>5.2</span> Selecting Through All Shadows: the <spanclass=cssdata-link-type=maybetitle=/shadow-deep/>/shadow-deep/</span> combinator</a>
124
-
<li><ahref=#content-combinator><spanclass=secno>5.3</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>
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>
125
124
<li><ahref=#selectors><spanclass=secno>6</span> Shadow DOM Selectors</a>
126
125
<ulclass=toc>
127
126
<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>
Selecting Into A Shadow Tree: the <aclass=cssdata-link-type=maybehref=#selectordef-shadow0title=/shadow/>/shadow/</a> combinator</span><aclass=self-linkhref=#shadow-combinator></a></h3>
323
-
324
-
<p> When a <dfnclass=css-codedata-dfn-type=selectordata-export="" id=selectordef-shadow0>/shadow/<aclass=self-linkhref=#selectordef-shadow0></a></dfn> combinator is encountered in a selector,
325
-
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=#shadow-treetitle="shadow trees">shadow trees</a>.
326
-
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>
327
-
with the <adata-link-type=dfnhref=#top-level-elementtitle="top-level elements">top-level elements</a> of each <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a> of the element,
328
-
and every element reachable by traversing any number of child lists
329
-
from those elements.
330
-
331
-
<divclass=example>
332
-
For example, say you had a component with a <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a> like the following:
333
-
334
-
<pre> <x-foo>
335
-
<"shadow tree">
336
-
<div>
337
-
<span id="not-top">...</span>
338
-
</div>
339
-
<span id="top">...</span>
340
-
<x-bar>
341
-
<"shadow tree">
342
-
<span id="nested">...</span>
343
-
</>
344
-
</x-bar>
345
-
</>
346
-
</x-foo>
347
-
</pre>
348
-
<p> For a stylesheet in the outer document,
349
-
the selector <spanclass=cssdata-link-type=maybetitle="x-foo /shadow/ span">x-foo /shadow/ span</span>
350
-
selects <spanclass=cssdata-link-type=maybetitle=#top>#top</span> and <spanclass=cssdata-link-type=maybetitle=#not-top>#not-top</span>.
351
-
It does not match <spanclass=cssdata-link-type=maybetitle=#nested>#nested</span>,
352
-
as that element is further nested in the <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a> of the <code><x-bar></code> component.
353
-
</div>
354
-
355
-
<divclass=example>
356
-
If an element has multiple <adata-link-type=dfnhref=#shadow-treetitle="shadow trees">shadow trees</a>,
357
-
a selector using <aclass=cssdata-link-type=maybehref=#selectordef-shadow0title=/shadow/>/shadow/</a> targets the elements in <em>all</em> of them.
358
-
359
-
<p> Similarly,
360
-
inside of a <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a>,
361
-
a selector like <spanclass=cssdata-link-type=maybetitle=":host /shadow/ div">:host /shadow/ div</span> selects the <adata-link-type=elementhref=http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-div-elementtitle=div>div</a> elements in <em>all</em> the <adata-link-type=dfnhref=#shadow-treetitle="shadow trees">shadow trees</a> on the element,
Selecting Through All Shadows: the <aclass=cssdata-link-type=maybehref=#selectordef-shadow-deeptitle=/shadow-deep/>/shadow-deep/</a> combinator</span><aclass=self-linkhref=#shadow-deep-combinator></a></h3>
367
322
368
323
<p> When a <dfnclass=css-codedata-dfn-type=selectordata-export="" id=selectordef-shadow-deep>/shadow-deep/<aclass=self-linkhref=#selectordef-shadow-deep></a></dfn> combinator is encountered in a selector,
Selecting Distributed Elements: the <aclass=cssdata-link-type=maybehref=#selectordef-contenttitle=/content/>/content/</a> combinator</span><aclass=self-linkhref=#content-combinator></a></h3>
398
353
399
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,
<p> If one wanted to target <spanclass=cssdata-link-type=maybetitle=#not-top>#not-top</span>,
540
495
one way to do it would be with <spanclass=cssdata-link-type=maybetitle="x-foo::shadow > div > span">x-foo::shadow > div > span</span>.
541
496
However, this introduces a strong dependency on the internal structure of the component;
542
-
in most cases, it’s better to use the <aclass=cssdata-link-type=maybehref=#selectordef-shadow0title=/shadow/>/shadow/</a> combinator,
497
+
in most cases, it’s better to use the <spanclass=cssdata-link-type=maybetitle=/shadow/>/shadow/</span> combinator,
543
498
like <spanclass=cssdata-link-type=maybetitle="x-foo /shadow/ span">x-foo /shadow/ span</span>,
544
499
to select all the elements of some type in the <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a>.
545
500
</div>
546
501
502
+
<divclass=example>
503
+
If an element has multiple <adata-link-type=dfnhref=#shadow-treetitle="shadow trees">shadow trees</a>,
504
+
a <aclass=cssdata-link-type=maybehref=#selectordef-shadowtitle=::shadow>::shadow</a> pseudo-element selects <em>all</em> of the corresponding <adata-link-type=dfnhref=#shadow-roottitle="shadow roots">shadow roots</a>.
505
+
506
+
<p> Similarly,
507
+
inside of a <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a>,
508
+
a selector like <spanclass=cssdata-link-type=maybetitle=":host::shadow div">:host::shadow div</span> selects the <adata-link-type=elementhref=http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-div-elementtitle=div>div</a> elements in <em>all</em> the <adata-link-type=dfnhref=#shadow-treetitle="shadow trees">shadow trees</a> on the element,
0 commit comments