Skip to content

Commit 1ee80f1

Browse files
committed
[shadow-styling] Define cascading and scoping.
1 parent 49fb1b3 commit 1ee80f1

2 files changed

Lines changed: 24 additions & 29 deletions

File tree

shadow-styling/Overview.bs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ED: http://dev.w3.org/csswg/shadow-styling
88
Editor: Tab Atkins Jr., Google, http://xanthir.com/contact/
99
Abstract: This specification defines the additions to CSS to accommodate Shadow DOM styling.
1010
Ignored Terms: content
11+
Link Defaults: selectors-4 (dfn) scoped selectors/scope/scoping root
1112
</pre>
1213

1314
<h2 id="intro">
@@ -28,7 +29,7 @@ Shadow Trees</h3>
2829
that can be attached to any element in the DOM.
2930
An element can have any number of <a>shadow trees</a>,
3031
which are ordered by creation time.
31-
The most recently-createed <a>shadow tree</a> on an element
32+
The most recently-created <a>shadow tree</a> on an element
3233
is the <dfn export>active shadow tree</dfn> for that element.
3334

3435
An element with a <a>shadow tree</a> is a <dfn export>shadow host</dfn>.
@@ -39,6 +40,10 @@ Shadow Trees</h3>
3940
Instead, the contents of the <a>active shadow tree</a> generates boxes
4041
as if it were the contents of the element instead.
4142

43+
All selectors appearing in a <a>shadow tree</a>
44+
are <a>scoped selectors</a>,
45+
with the <a>host element</a> as their <a>scoping root</a>.
46+
4247
<h3 id='distribution-lists'>
4348
Distribution Lists</h3>
4449

@@ -383,13 +388,10 @@ Selecting Based on an Ancestor Outside the Shadow Tree: the '':ancestor()'' pseu
383388
<h2 id='cascading'>
384389
Changes to the Cascading Model</h2>
385390

386-
Shadow DOM enables new ways to target an element and apply styles to it,
387-
which don't quite fit into the existing CSS cascade.
391+
When calculating <a href="http://dev.w3.org/csswg/css-cascade/#cascade-order">cascade order</a>,
392+
declarations in <a>shadow trees</a> are ordered by creation time,
393+
with younger <a>shadow trees</a> treated as coming after older <a>shadow trees</a>
394+
within a given <a>host element</a>.
388395

389-
<p class='issue'>
390-
I need to go look up what was decided/written down
391-
for the cascading precedence
392-
of rules from outside a shadow tree reaching in, via the /shadow-* combinators,
393-
and of rules from inside a shadow tree reaching out, via the /content combinator.
394-
Also, the cascading precedence of styles inside a shadow tree applying to a host element,
395-
versus the outside document's styles applying to the host element.
396+
Note: Note that styles in a shadow tree are <a>scoped</a> to their <a>host element</a>,
397+
so no further ordering is necessary to define.

shadow-styling/Overview.html

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ <h3 class="heading settled heading" data-level=2.1 id=shadow-trees><span class=s
155155
that can be attached to any element in the DOM.
156156
An element can have any number of <a data-link-type=dfn href=#shadow-tree title="shadow trees">shadow trees</a>,
157157
which are ordered by creation time.
158-
The most recently-createed <a data-link-type=dfn href=#shadow-tree title="shadow tree">shadow tree</a> on an element
158+
The most recently-created <a data-link-type=dfn href=#shadow-tree title="shadow tree">shadow tree</a> on an element
159159
is the <dfn data-dfn-type=dfn data-export="" id=active-shadow-tree>active shadow tree<a class=self-link href=#active-shadow-tree></a></dfn> for that element.
160160

161161
<p> An element with a <a data-link-type=dfn href=#shadow-tree title="shadow tree">shadow tree</a> is a <dfn data-dfn-type=dfn data-export="" id=shadow-host>shadow host<a class=self-link href=#shadow-host></a></dfn>.
@@ -166,6 +166,10 @@ <h3 class="heading settled heading" data-level=2.1 id=shadow-trees><span class=s
166166
Instead, the contents of the <a data-link-type=dfn href=#active-shadow-tree title="active shadow tree">active shadow tree</a> generates boxes
167167
as if it were the contents of the element instead.
168168

169+
<p> All selectors appearing in a <a data-link-type=dfn href=#shadow-tree title="shadow tree">shadow tree</a>
170+
are <a data-link-type=dfn href=http://dev.w3.org/csswg/selectors-4/#scope title="scoped selectors">scoped selectors</a>,
171+
with the <a data-link-type=dfn href=#host-element0 title="host element">host element</a> as their <a data-link-type=dfn href=http://dev.w3.org/csswg/selectors-4/#scoping-root title="scoping root">scoping root</a>.
172+
169173
<h3 class="heading settled heading" data-level=2.2 id=distribution-lists><span class=secno>2.2 </span><span class=content>
170174
Distribution Lists</span><a class=self-link href=#distribution-lists></a></h3>
171175

@@ -498,16 +502,13 @@ <h3 class="heading settled heading" data-level=5.3 id=ancestor-selector><span cl
498502
<h2 class="heading settled heading" data-level=6 id=cascading><span class=secno>6 </span><span class=content>
499503
Changes to the Cascading Model</span><a class=self-link href=#cascading></a></h2>
500504

501-
<p> Shadow DOM enables new ways to target an element and apply styles to it,
502-
which don’t quite fit into the existing CSS cascade.
505+
<p> When calculating <a href=http://dev.w3.org/csswg/css-cascade/#cascade-order>cascade order</a>,
506+
declarations in <a data-link-type=dfn href=#shadow-tree title="shadow trees">shadow trees</a> are ordered by creation time,
507+
with younger <a data-link-type=dfn href=#shadow-tree title="shadow trees">shadow trees</a> treated as coming after older <a data-link-type=dfn href=#shadow-tree title="shadow trees">shadow trees</a>
508+
within a given <a data-link-type=dfn href=#host-element0 title="host element">host element</a>.
503509

504-
<p class=issue id=issue-9ae761db><a class=self-link href=#issue-9ae761db></a>
505-
I need to go look up what was decided/written down
506-
for the cascading precedence
507-
of rules from outside a shadow tree reaching in, via the /shadow-* combinators,
508-
and of rules from inside a shadow tree reaching out, via the /content combinator.
509-
Also, the cascading precedence of styles inside a shadow tree applying to a host element,
510-
versus the outside document’s styles applying to the host element.
510+
<p class=note> Note: Note that styles in a shadow tree are <a data-link-type=dfn href=http://dev.w3.org/csswg/css-cascade-3/#scoped title=scoped>scoped</a> to their <a data-link-type=dfn href=#host-element0 title="host element">host element</a>,
511+
so no further ordering is necessary to define.
511512

512513
<h2 class="no-ref no-num heading settled heading" id=conformance><span class=content>
513514
Conformance</span><a class=self-link href=#conformance></a></h2>
@@ -668,12 +669,4 @@ <h2 class="no-num no-ref heading settled heading" id=property-index><span class=
668669
<h2 class="no-num heading settled" id=issues-index><span class=content>Issues Index</span><a class=self-link href=#issues-index></a></h2><div style="counter-reset: issue"><div class=issue>
669670
I’m assuming here that "/foo/" is the syntax we’ll agree on for named combinators.
670671

671-
<a href=#issue-46cdc4d6></a></div><div class=issue>
672-
I need to go look up what was decided/written down
673-
for the cascading precedence
674-
of rules from outside a shadow tree reaching in, via the /shadow-* combinators,
675-
and of rules from inside a shadow tree reaching out, via the /content combinator.
676-
Also, the cascading precedence of styles inside a shadow tree applying to a host element,
677-
versus the outside document’s styles applying to the host element.
678-
679-
<a href=#issue-9ae761db></a></div></div>
672+
<a href=#issue-46cdc4d6></a></div></div>

0 commit comments

Comments
 (0)