Skip to content

Commit 9aeb489

Browse files
committed
[shadow-styling] Rearrange more sections.
1 parent 91a9990 commit 9aeb489

2 files changed

Lines changed: 165 additions & 170 deletions

File tree

shadow-styling/Overview.bs

Lines changed: 67 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ Introduction</h2>
1616

1717
...
1818

19+
20+
1921
<h2 id='shadow-dom'>
20-
Shadow DOM CSS Concepts</h2>
22+
Shadow Encapsulation</h2>
2123

2224
The Shadow DOM spec augments the DOM with several new concepts,
2325
several of which are relevant to CSS.
2426

25-
<h3 id='shadow-trees'>
26-
Shadow Trees</h3>
27-
2827
A <dfn export>shadow tree</dfn> is a document fragment
2928
that can be attached to any element in the DOM.
3029
The root of the <a>shadow tree</a> is a <dfn export>shadow root</dfn>,
@@ -39,8 +38,8 @@ Shadow Trees</h3>
3938

4039
The descendants of a <a>shadow host</a>
4140
must not generate boxes in the formatting tree.
42-
Instead, the contents of the <a>active shadow tree</a> generates boxes
43-
as if it were the contents of the element instead.
41+
Instead, the contents of the <a>active shadow tree</a> generate boxes
42+
as if they were the contents of the element instead.
4443

4544
In several instances in shadow DOM,
4645
elements don't have element parents
@@ -50,9 +49,6 @@ Shadow Trees</h3>
5049
or whose parent is not an element,
5150
is called a <dfn export>top-level element</dfn>.
5251

53-
<h3 id='distribution-lists'>
54-
Distribution Lists</h3>
55-
5652
While the children of a <a>shadow host</a> do not generate boxes normally,
5753
they can be explicitly pulled into a <a>shadow tree</a> and forced to render normally.
5854
This is done by assigning the elements to a <dfn export>distribution list</dfn>.
@@ -68,8 +64,8 @@ Distribution Lists</h3>
6864
as if they all replaced the <a>insertion point</a> in-place.
6965
<span class='note'>(Akin to the behavior of ''display-box: contents''.)</span>
7066

71-
<h2 id='selectors-data-model'>
72-
Extensions to the Selectors Data Model</h2>
67+
<h3 id='selectors-data-model'>
68+
Shadow DOM Selection Model</h3>
7369

7470
Elements in the <a>element tree</a>
7571
additionally have zero or more <a>shadow trees</a>
@@ -86,8 +82,8 @@ Extensions to the Selectors Data Model</h2>
8682
and their descendants,
8783
ordered by a pre-order traversal.
8884

89-
<h3 id='host-element'>
90-
Host Elements in a Shadow Tree</h3>
85+
<h4 id='host-element'>
86+
Host Elements in a Shadow Tree</h4>
9187

9288
A <a>shadow host</a> is outside of the <a>shadow trees</a> it hosts,
9389
but it is sometimes useful to be able to style it from inside the <a>shadow tree</a> context.
@@ -130,58 +126,14 @@ Host Elements in a Shadow Tree</h3>
130126
</details>
131127

132128

133-
134-
<h2 id='cascading'>
135-
Changes to the Cascading Model</h2>
136-
137-
To address the desired cascading behavior of rules targetting elements in shadow roots,
138-
this specification extends the <a href="http://dev.w3.org/csswg/css-cascade/#cascading">cascade order</a>
139-
defined in the Cascade specification. [[!CSS3CASCADE]]
140-
141-
An additional cascade criteria must be added,
142-
between Origin and Scope,
143-
called Shadow Tree.
144-
145-
<ul>
146-
<li>
147-
When comparing two declarations,
148-
if one of them is in a <a>shadow tree</a>
149-
and the other is in a document that contains that <a>shadow tree</a>,
150-
then for normal rules the declaration from the outer document wins,
151-
and for important rules the declaration from the <a>shadow tree</a> wins.
152-
153-
Note: This is the <em>opposite</em> of how scoped styles work.
154-
155-
<li>
156-
When comparing two declarations,
157-
if both are in <a>shadow trees</a> with the same <a>host element</a>,
158-
then for normal rules the declaration from the <a>shadow tree</a> that was created most recently wins,
159-
and for important rules the declaration from the <a>shadow tree</a> that was created less recently wins.
160-
</ul>
161-
162-
When calculating <a href="http://dev.w3.org/csswg/css-cascade/#cascade-order">Order of Appearance</a>,
163-
the tree of trees,
164-
defined by the Shadow DOM specification,
165-
is used to calculate ordering.
166-
167-
<h3 id='inheritance'>
168-
Inheritance and Shadow DOM</h3>
169-
170-
The <a>top-level elements</a> of a <a>shadow tree</a>
171-
inherit from their <a>host element</a>.
172-
173-
The elements in a <a>distribution list</a> inherit from the parent of the <a element>content</a> element they are ultimately distributed to,
174-
rather than from their normal parent.
175-
176-
177-
<h2 id='selectors'>
178-
Shadow DOM Selectors</h2>
129+
<h3 id='selectors'>
130+
Shadow DOM Selectors</h3>
179131

180132
Shadow DOM defines a few new selectors
181133
to help select elements in useful way related to Shadow DOM.
182134

183-
<h3 id='host-selector'>
184-
Selecting the Host Element: the '':host'' and '':host()'' pseudo-classes</h3>
135+
<h4 id='host-selector'>
136+
Selecting Into the Light: the '':host'', '':host()'', and '':host-context()'' pseudo-classes</h4>
185137

186138
The <dfn selector>:host</dfn> pseudo-class,
187139
when evaluated in the context of a <a>shadow tree</a>,
@@ -224,9 +176,6 @@ Selecting the Host Element: the '':host'' and '':host()'' pseudo-classes</h3>
224176
</ul>
225177
</div>
226178

227-
<h3 id='ancestor-selector'>
228-
Selecting Based on an Ancestor Outside the Shadow Tree: the '':host-context()'' pseudo-class</h3>
229-
230179
Ordinary, selectors within a <a>shadow tree</a>
231180
can't see elements outside the <a>shadow tree</a> at all.
232181
Sometimes, however, it's useful to select an ancestor that lies somewhere outside the shadow tree,
@@ -260,8 +209,8 @@ Selecting Based on an Ancestor Outside the Shadow Tree: the '':host-context()''
260209
looking for elements that match its argument,
261210
until it reaches the document root.
262211

263-
<h3 id='shadow-pseudoelement'>
264-
Selecting the Shadow Root Itself: the ''::shadow'' pseudo-element</h3>
212+
<h4 id='shadow-pseudoelement'>
213+
Selecting Into the Dark: the ''::shadow'' pseudo-element</h4>
265214

266215
If an element has at least one <a>shadow tree</a>,
267216
the <dfn>::shadow</dfn> pseudo-element matches the <a>shadow roots</a> themselves.
@@ -312,8 +261,8 @@ Selecting the Shadow Root Itself: the ''::shadow'' pseudo-element</h3>
312261

313262

314263

315-
<h3 id='content-combinator'>
316-
Selecting Distributed Elements: the ''::content'' pseudo-element</h3>
264+
<h4 id='content-combinator'>
265+
Selecting Shadow-Projected Content: the ''::content'' pseudo-element</h4>
317266

318267
The <dfn selector>::content</dfn> pseudo-element matches the <a>distribution list</a> itself,
319268
on elements that have one.
@@ -362,8 +311,8 @@ Selecting Distributed Elements: the ''::content'' pseudo-element</h3>
362311
</div>
363312

364313

365-
<h3 id='deep-combinator'>
366-
Selecting Through All Shadows: the ''/deep/'' combinator</h3>
314+
<h4 id='deep-combinator'>
315+
Selecting Through Shadows: the ''/deep/'' combinator</h4>
367316

368317
When a <dfn selector>/deep/</dfn> combinator is encountered in a selector,
369318
replace every element in the <a>selector match list</a>
@@ -402,3 +351,51 @@ Selecting Through All Shadows: the ''/deep/'' combinator</h3>
402351
Maybe we can give the descendant combinator a pseudonym of ''>>'',
403352
as it itself is a super-child combinator?
404353
Then ''/deep/'' could be spelled ''>>>''
354+
355+
356+
357+
358+
<h3 id='shadow-cascading'>
359+
Shadow Cascading & Inheritance</h3>
360+
361+
<h4 id='cascading'>
362+
Cascading</h4>
363+
364+
To address the desired cascading behavior of rules targetting elements in shadow roots,
365+
this specification extends the <a href="http://dev.w3.org/csswg/css-cascade/#cascading">cascade order</a>
366+
defined in the Cascade specification. [[!CSS3CASCADE]]
367+
368+
An additional cascade criteria must be added,
369+
between Origin and Scope,
370+
called Shadow Tree.
371+
372+
<ul>
373+
<li>
374+
When comparing two declarations,
375+
if one of them is in a <a>shadow tree</a>
376+
and the other is in a document that contains that <a>shadow tree</a>,
377+
then for normal rules the declaration from the outer document wins,
378+
and for important rules the declaration from the <a>shadow tree</a> wins.
379+
380+
Note: This is the <em>opposite</em> of how scoped styles work.
381+
382+
<li>
383+
When comparing two declarations,
384+
if both are in <a>shadow trees</a> with the same <a>host element</a>,
385+
then for normal rules the declaration from the <a>shadow tree</a> that was created most recently wins,
386+
and for important rules the declaration from the <a>shadow tree</a> that was created less recently wins.
387+
</ul>
388+
389+
When calculating <a href="http://dev.w3.org/csswg/css-cascade/#cascade-order">Order of Appearance</a>,
390+
the tree of trees,
391+
defined by the Shadow DOM specification,
392+
is used to calculate ordering.
393+
394+
<h4 id='inheritance'>
395+
Inheritance</h4>
396+
397+
The <a>top-level elements</a> of a <a>shadow tree</a>
398+
inherit from their <a>host element</a>.
399+
400+
The elements in a <a>distribution list</a> inherit from the parent of the <a element>content</a> element they are ultimately distributed to,
401+
rather than from their normal parent.

0 commit comments

Comments
 (0)