Skip to content

Commit 7a2c583

Browse files
committed
[shadow-styling] Kill the /shadow/ section, stick with ::shadow.
1 parent c8ef08f commit 7a2c583

2 files changed

Lines changed: 27 additions & 99 deletions

File tree

shadow-styling/Overview.bs

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -184,52 +184,6 @@ Shadow DOM Combinators</h2>
184184
<p class='issue'>
185185
I'm assuming here that "/foo/" is the syntax we'll agree on for named combinators.
186186

187-
<h3 id='shadow-combinator'>
188-
Selecting Into A Shadow Tree: the ''/shadow/'' combinator</h3>
189-
190-
When a <dfn selector>/shadow/</dfn> combinator is encountered in a selector,
191-
first filter the <a>selector match list</a> to only include elements with <a>shadow trees</a>.
192-
Then replace every element in the <a>selector match list</a>
193-
with the <a>top-level elements</a> of each <a>shadow tree</a> of the element,
194-
and every element reachable by traversing any number of child lists
195-
from those elements.
196-
197-
<div class='example'>
198-
For example, say you had a component with a <a>shadow tree</a> like the following:
199-
200-
<pre>
201-
&lt;x-foo>
202-
&lt;"shadow tree">
203-
&lt;div>
204-
&lt;span id="not-top">...&lt;/span>
205-
&lt;/div>
206-
&lt;span id="top">...&lt;/span>
207-
&lt;x-bar>
208-
&lt;"shadow tree">
209-
&lt;span id="nested">...&lt;/span>
210-
&lt;/>
211-
&lt;/x-bar>
212-
&lt;/>
213-
&lt;/x-foo>
214-
</pre>
215-
216-
For a stylesheet in the outer document,
217-
the selector ''x-foo /shadow/ span''
218-
selects ''#top'' and ''#not-top''.
219-
It does not match ''#nested'',
220-
as that element is further nested in the <a>shadow tree</a> of the <code>&lt;x-bar></code> component.
221-
</div>
222-
223-
<div class='example'>
224-
If an element has multiple <a>shadow trees</a>,
225-
a selector using ''/shadow/'' targets the elements in <em>all</em> of them.
226-
227-
Similarly,
228-
inside of a <a>shadow tree</a>,
229-
a selector like '':host /shadow/ div'' selects the <a element>div</a> elements in <em>all</em> the <a>shadow trees</a> on the element,
230-
not just the one containing that selector.
231-
</div>
232-
233187
<h3 id='shadow-deep-combinator'>
234188
Selecting Through All Shadows: the ''/shadow-deep/'' combinator</h3>
235189

@@ -421,3 +375,13 @@ Selecting the Shadow Root Itself: the ''::shadow'' pseudo-element</h3>
421375
like ''x-foo /shadow/ span'',
422376
to select all the elements of some type in the <a>shadow tree</a>.
423377
</div>
378+
379+
<div class='example'>
380+
If an element has multiple <a>shadow trees</a>,
381+
a ''::shadow'' pseudo-element selects <em>all</em> of the corresponding <a>shadow roots</a>.
382+
383+
Similarly,
384+
inside of a <a>shadow tree</a>,
385+
a selector like '':host::shadow div'' selects the <a element>div</a> elements in <em>all</em> the <a>shadow trees</a> on the element,
386+
not just the one containing that selector.
387+
</div>

shadow-styling/Overview.html

Lines changed: 17 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,8 @@ <h2 class="no-num no-toc no-ref heading settled heading" id=contents><span class
119119
<li><a href=#inheritance0><span class=secno>4.1</span> Inheritance and Shadow DOM</a></ul>
120120
<li><a href=#inheritance><span class=secno>5</span> Shadow DOM Combinators</a>
121121
<ul class=toc>
122-
<li><a href=#shadow-combinator><span class=secno>5.1</span> Selecting Into A Shadow Tree: the <span class=css data-link-type=maybe title=/shadow/>/shadow/</span> combinator</a>
123-
<li><a href=#shadow-deep-combinator><span class=secno>5.2</span> Selecting Through All Shadows: the <span class=css data-link-type=maybe title=/shadow-deep/>/shadow-deep/</span> combinator</a>
124-
<li><a href=#content-combinator><span class=secno>5.3</span> Selecting Distributed Elements: the <span class=css data-link-type=maybe title=/content/>/content/</span> combinator</a></ul>
122+
<li><a href=#shadow-deep-combinator><span class=secno>5.1</span> Selecting Through All Shadows: the <span class=css data-link-type=maybe title=/shadow-deep/>/shadow-deep/</span> combinator</a>
123+
<li><a href=#content-combinator><span class=secno>5.2</span> Selecting Distributed Elements: the <span class=css data-link-type=maybe title=/content/>/content/</span> combinator</a></ul>
125124
<li><a href=#selectors><span class=secno>6</span> Shadow DOM Selectors</a>
126125
<ul class=toc>
127126
<li><a href=#host-selector><span class=secno>6.1</span> Selecting the Host Element: the <span class=css data-link-type=maybe title=:host>:host</span> and <span class=css data-link-type=maybe title=:host()>:host()</span> pseudo-classes</a>
@@ -318,51 +317,7 @@ <h2 class="heading settled heading" data-level=5 id=inheritance><span class=secn
318317
<p class=issue id=issue-46cdc4d6><a class=self-link href=#issue-46cdc4d6></a>
319318
I’m assuming here that "/foo/" is the syntax we’ll agree on for named combinators.
320319

321-
<h3 class="heading settled heading" data-level=5.1 id=shadow-combinator><span class=secno>5.1 </span><span class=content>
322-
Selecting Into A Shadow Tree: the <a class=css data-link-type=maybe href=#selectordef-shadow0 title=/shadow/>/shadow/</a> combinator</span><a class=self-link href=#shadow-combinator></a></h3>
323-
324-
<p> When a <dfn class=css-code data-dfn-type=selector data-export="" id=selectordef-shadow0>/shadow/<a class=self-link href=#selectordef-shadow0></a></dfn> combinator is encountered in a selector,
325-
first filter the <a data-link-type=dfn href=http://dev.w3.org/csswg/selectors-4/#selector-match-list title="selector match list">selector match list</a> to only include elements with <a data-link-type=dfn href=#shadow-tree title="shadow trees">shadow trees</a>.
326-
Then replace every element in the <a data-link-type=dfn href=http://dev.w3.org/csswg/selectors-4/#selector-match-list title="selector match list">selector match list</a>
327-
with the <a data-link-type=dfn href=#top-level-element title="top-level elements">top-level elements</a> of each <a data-link-type=dfn href=#shadow-tree title="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-
<div class=example>
332-
For example, say you had a component with a <a data-link-type=dfn href=#shadow-tree title="shadow tree">shadow tree</a> like the following:
333-
334-
<pre> &lt;x-foo&gt;
335-
&lt;"shadow tree"&gt;
336-
&lt;div&gt;
337-
&lt;span id="not-top"&gt;...&lt;/span&gt;
338-
&lt;/div&gt;
339-
&lt;span id="top"&gt;...&lt;/span&gt;
340-
&lt;x-bar&gt;
341-
&lt;"shadow tree"&gt;
342-
&lt;span id="nested"&gt;...&lt;/span&gt;
343-
&lt;/&gt;
344-
&lt;/x-bar&gt;
345-
&lt;/&gt;
346-
&lt;/x-foo&gt;
347-
</pre>
348-
<p> For a stylesheet in the outer document,
349-
the selector <span class=css data-link-type=maybe title="x-foo /shadow/ span">x-foo /shadow/ span</span>
350-
selects <span class=css data-link-type=maybe title=#top>#top</span> and <span class=css data-link-type=maybe title=#not-top>#not-top</span>.
351-
It does not match <span class=css data-link-type=maybe title=#nested>#nested</span>,
352-
as that element is further nested in the <a data-link-type=dfn href=#shadow-tree title="shadow tree">shadow tree</a> of the <code>&lt;x-bar&gt;</code> component.
353-
</div>
354-
355-
<div class=example>
356-
If an element has multiple <a data-link-type=dfn href=#shadow-tree title="shadow trees">shadow trees</a>,
357-
a selector using <a class=css data-link-type=maybe href=#selectordef-shadow0 title=/shadow/>/shadow/</a> targets the elements in <em>all</em> of them.
358-
359-
<p> Similarly,
360-
inside of a <a data-link-type=dfn href=#shadow-tree title="shadow tree">shadow tree</a>,
361-
a selector like <span class=css data-link-type=maybe title=":host /shadow/ div">:host /shadow/ div</span> selects the <a data-link-type=element href=http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-div-element title=div>div</a> elements in <em>all</em> the <a data-link-type=dfn href=#shadow-tree title="shadow trees">shadow trees</a> on the element,
362-
not just the one containing that selector.
363-
</div>
364-
365-
<h3 class="heading settled heading" data-level=5.2 id=shadow-deep-combinator><span class=secno>5.2 </span><span class=content>
320+
<h3 class="heading settled heading" data-level=5.1 id=shadow-deep-combinator><span class=secno>5.1 </span><span class=content>
366321
Selecting Through All Shadows: the <a class=css data-link-type=maybe href=#selectordef-shadow-deep title=/shadow-deep/>/shadow-deep/</a> combinator</span><a class=self-link href=#shadow-deep-combinator></a></h3>
367322

368323
<p> When a <dfn class=css-code data-dfn-type=selector data-export="" id=selectordef-shadow-deep>/shadow-deep/<a class=self-link href=#selectordef-shadow-deep></a></dfn> combinator is encountered in a selector,
@@ -393,7 +348,7 @@ <h3 class="heading settled heading" data-level=5.2 id=shadow-deep-combinator><sp
393348
<span class=css data-link-type=maybe title=#top>#top</span>, <span class=css data-link-type=maybe title=#not-top>#not-top</span>, <em>and</em> <span class=css data-link-type=maybe title=#nested>#nested</span>.
394349
</div>
395350

396-
<h3 class="heading settled heading" data-level=5.3 id=content-combinator><span class=secno>5.3 </span><span class=content>
351+
<h3 class="heading settled heading" data-level=5.2 id=content-combinator><span class=secno>5.2 </span><span class=content>
397352
Selecting Distributed Elements: the <a class=css data-link-type=maybe href=#selectordef-content title=/content/>/content/</a> combinator</span><a class=self-link href=#content-combinator></a></h3>
398353

399354
<p> When a <dfn class=css-code data-dfn-type=selector data-export="" id=selectordef-content>/content/<a class=self-link href=#selectordef-content></a></dfn> combinator is encountered in a selector,
@@ -539,11 +494,21 @@ <h3 class="heading settled heading" data-level=6.3 id=shadow-pseudoelement><span
539494
<p> If one wanted to target <span class=css data-link-type=maybe title=#not-top>#not-top</span>,
540495
one way to do it would be with <span class=css data-link-type=maybe title="x-foo::shadow > div > span">x-foo::shadow &gt; div &gt; span</span>.
541496
However, this introduces a strong dependency on the internal structure of the component;
542-
in most cases, it’s better to use the <a class=css data-link-type=maybe href=#selectordef-shadow0 title=/shadow/>/shadow/</a> combinator,
497+
in most cases, it’s better to use the <span class=css data-link-type=maybe title=/shadow/>/shadow/</span> combinator,
543498
like <span class=css data-link-type=maybe title="x-foo /shadow/ span">x-foo /shadow/ span</span>,
544499
to select all the elements of some type in the <a data-link-type=dfn href=#shadow-tree title="shadow tree">shadow tree</a>.
545500
</div>
546501

502+
<div class=example>
503+
If an element has multiple <a data-link-type=dfn href=#shadow-tree title="shadow trees">shadow trees</a>,
504+
a <a class=css data-link-type=maybe href=#selectordef-shadow title=::shadow>::shadow</a> pseudo-element selects <em>all</em> of the corresponding <a data-link-type=dfn href=#shadow-root title="shadow roots">shadow roots</a>.
505+
506+
<p> Similarly,
507+
inside of a <a data-link-type=dfn href=#shadow-tree title="shadow tree">shadow tree</a>,
508+
a selector like <span class=css data-link-type=maybe title=":host::shadow div">:host::shadow div</span> selects the <a data-link-type=element href=http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-div-element title=div>div</a> elements in <em>all</em> the <a data-link-type=dfn href=#shadow-tree title="shadow trees">shadow trees</a> on the element,
509+
not just the one containing that selector.
510+
</div>
511+
547512
<h2 class="no-ref no-num heading settled heading" id=conformance><span class=content>
548513
Conformance</span><a class=self-link href=#conformance></a></h2>
549514

@@ -680,15 +645,14 @@ <h2 class="no-num no-ref heading settled heading" id=index><span class=content>
680645
<div data-fill-with=index><ul class=indexlist>
681646
<li>active shadow tree, <a href=#active-shadow-tree title="section 2.1">2.1</a>
682647
<li>:ancestor(), <a href=#selectordef-ancestor title="section 6.2">6.2</a>
683-
<li>/content/, <a href=#selectordef-content title="section 5.3">5.3</a>
648+
<li>/content/, <a href=#selectordef-content title="section 5.2">5.2</a>
684649
<li>distribution list, <a href=#distribution-list title="section 2.2">2.2</a>
685650
<li>:host(), <a href=#selectordef-host title="section 6.1">6.1</a>
686651
<li>:host, <a href=#selectordef-host0 title="section 6.1">6.1</a>
687652
<li>host element, <a href=#host-element0 title="section 2.1">2.1</a>
688653
<li>insertion point, <a href=#insertion-point title="section 2.2">2.2</a>
689654
<li>::shadow, <a href=#selectordef-shadow title="section 6.3">6.3</a>
690-
<li>/shadow/, <a href=#selectordef-shadow0 title="section 5.1">5.1</a>
691-
<li>/shadow-deep/, <a href=#selectordef-shadow-deep title="section 5.2">5.2</a>
655+
<li>/shadow-deep/, <a href=#selectordef-shadow-deep title="section 5.1">5.1</a>
692656
<li>shadow host, <a href=#shadow-host title="section 2.1">2.1</a>
693657
<li>shadow root, <a href=#shadow-root title="section 2.1">2.1</a>
694658
<li>shadow tree, <a href=#shadow-tree title="section 2.1">2.1</a>

0 commit comments

Comments
 (0)