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=#inheritance><spanclass=secno>4</span> Shadow DOM Combinators</a>
119
119
<ulclass=toc>
120
120
<li><ahref=#shadow-combinator><spanclass=secno>4.1</span> Selecting Into A Shadow Tree: the <spanclass=cssdata-link-type=maybetitle=/shadow/>/shadow/</span> combinator</a>
121
-
<li><ahref=#shadow-all-combinator><spanclass=secno>4.2</span> Selecting All Elements In A Shadow Tree: the <spanclass=cssdata-link-type=maybetitle=/shadow-all/>/shadow-all/</span> combinator</a>
121
+
<li><ahref=#shadow-child-combinator><spanclass=secno>4.2</span> Selecting the Top-level Elements in a Shadow Tree: the <spanclass=cssdata-link-type=maybetitle=/shadow-child/>/shadow-child/</span> combinator</a>
122
122
<li><ahref=#shadow-deep-combinator><spanclass=secno>4.3</span> Selecting Through All Shadows: the <spanclass=cssdata-link-type=maybetitle=/shadow-deep/>/shadow-deep/</span> combinator</a>
123
123
<li><ahref=#content-combinator><spanclass=secno>4.4</span> Selecting Distributed Elements: the <spanclass=cssdata-link-type=maybetitle=/content/>/content/</span> combinator</a></ul>
124
124
<li><ahref=#selectors><spanclass=secno>5</span> Shadow DOM Selectors</a>
<p> When a <dfnclass=css-codedata-dfn-type=selectordata-export="" id=selectordef-shadow>/shadow/<aclass=self-linkhref=#selectordef-shadow></a></dfn> combinator is encountered in a selector,
284
284
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>.
285
285
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>
286
-
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.
286
+
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,
287
+
and every element reachable by traversing any number of child lists
288
+
from those elements.
287
289
288
290
<divclass=example>
289
291
For example, say you had a component with a <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a> like the following:
but not <spanclass=cssdata-link-type=maybetitle=#not-top>#not-top</span>,
303
-
because it’s not a <adata-link-type=dfnhref=#top-level-elementtitle="top-level element">top-level element</a> in the <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a>.
304
-
305
-
<p> If one wanted to target <spanclass=cssdata-link-type=maybetitle=#not-top>#not-top</span>,
306
-
one way to do it would be with <spanclass=cssdata-link-type=maybetitle="x-foo /shadow/ div > span">x-foo /shadow/ div > span</span>.
308
+
the selector <spanclass=cssdata-link-type=maybetitle="x-foo /shadow/ span">x-foo /shadow/ span</span>
309
+
selects <spanclass=cssdata-link-type=maybetitle=#top>#top</span> and <spanclass=cssdata-link-type=maybetitle=#not-top>#not-top</span>.
310
+
It does not match <spanclass=cssdata-link-type=maybetitle=#nested>#nested</span>,
311
+
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.
Selecting All Elements In A Shadow Tree: the <aclass=cssdata-link-type=maybehref=#selectordef-shadow-alltitle=/shadow-all/>/shadow-all/</a> combinator</span><aclass=self-linkhref=#shadow-all-combinator></a></h3>
Selecting the Top-level Elements in a Shadow Tree: the <aclass=cssdata-link-type=maybehref=#selectordef-shadow-childtitle=/shadow-child/>/shadow-child/</a> combinator</span><aclass=self-linkhref=#shadow-child-combinator></a></h3>
311
316
312
-
<p> When a <dfnclass=css-codedata-dfn-type=selectordata-export="" id=selectordef-shadow-all>/shadow-all/<aclass=self-linkhref=#selectordef-shadow-all></a></dfn> combinator is encountered in a selector,
317
+
<p> When a <dfnclass=css-codedata-dfn-type=selectordata-export="" id=selectordef-shadow-child>/shadow-child/<aclass=self-linkhref=#selectordef-shadow-child></a></dfn> combinator is encountered in a selector,
313
318
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>.
314
319
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>
315
-
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,
316
-
and every element reachable by traversing any number of child lists
317
-
from those elements.
320
+
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.
318
321
319
322
<divclass=example>
320
323
For example, say you had a component with a <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a> like the following:
the selector <spanclass=cssdata-link-type=maybetitle="x-foo /shadow-all/ span">x-foo /shadow-all/ span</span>
338
-
selects <spanclass=cssdata-link-type=maybetitle=#top>#top</span> and <spanclass=cssdata-link-type=maybetitle=#not-top>#not-top</span>.
339
-
It does not match <spanclass=cssdata-link-type=maybetitle=#nested>#nested</span>,
340
-
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.
but not <spanclass=cssdata-link-type=maybetitle=#not-top>#not-top</span>,
337
+
because it’s not a <adata-link-type=dfnhref=#top-level-elementtitle="top-level element">top-level element</a> in the <adata-link-type=dfnhref=#shadow-treetitle="shadow tree">shadow tree</a>.
338
+
339
+
<p> If one wanted to target <spanclass=cssdata-link-type=maybetitle=#not-top>#not-top</span>,
340
+
one way to do it would be with <spanclass=cssdata-link-type=maybetitle="x-foo /shadow-child/ div > span">x-foo /shadow-child/ div > span</span>.
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>
0 commit comments