Skip to content

Commit 3664d57

Browse files
mfreed7emilio
authored andcommitted
First (very) draft addition of adoptedStyleSheets
1 parent 2ed8784 commit 3664d57

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

css-cascade-5/Overview.bs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,7 @@ Cascade Sorting Order</h3>
10351035
For this purpose:
10361036

10371037
<ul>
1038+
<li>Style sheets are ordered as in <a href="https://www.w3.org/TR/cssom-1/#documentorshadowroot-final-css-style-sheets">final CSS style sheets</a>.
10381039
<li>Declarations from <a at-rule lt="@import">imported style sheets</a>
10391040
are ordered as if their style sheets were substituted in place of the ''@import'' rule.
10401041
<li>Declarations from style sheets independently linked by the originating document

cssom-1/Overview.bs

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,19 +1088,26 @@ CSS Style Sheet Collections {#css-style-sheet-collections}
10881088
Below various new concepts are defined that are associated with each
10891089
{{DocumentOrShadowRoot}} object.
10901090

1091-
Each {{DocumentOrShadowRoot}} has an associated list of zero or more
1092-
<a>CSS style sheets</a>, named the
1091+
Each {{DocumentOrShadowRoot}} has an associated list of zero or more <a>CSS style sheets</a>, named the
10931092
<dfn export for=DocumentOrShadowRoot>document or shadow root CSS style sheets</dfn>. This is
1094-
an ordered list that contains all
1095-
<a>CSS style sheets</a> associated with the
1096-
{{DocumentOrShadowRoot}}, in
1097-
<a>tree order</a>, with
1098-
<a>CSS style sheets</a> created from HTTP
1099-
<code>Link</code> headers first, if any, in header
1100-
order.
1101-
1102-
To <dfn export>create a CSS style sheet</dfn>, run these
1103-
steps:
1093+
an ordered list that contains:
1094+
<ol>
1095+
<li>Any <a>CSS style sheets</a> created from HTTP <code>Link</code> headers, in header order</li>
1096+
<li>Any <a>CSS style sheets</a> associated with the {{DocumentOrShadowRoot}}, in <a>tree order</a></li>
1097+
</ol>
1098+
1099+
Each {{DocumentOrShadowRoot}} has an associated list of zero or more <a>CSS style sheets</a>, named the
1100+
<dfn export for=DocumentOrShadowRoot>final CSS style sheets</dfn>. This is
1101+
an ordered list that contains:
1102+
<ol>
1103+
<li>Any <a>CSS style sheets</a> created from HTTP <code>Link</code> headers, in header order</li>
1104+
<li>Any <a>CSS style sheets</a> associated with the {{DocumentOrShadowRoot}}, in <a>tree order</a></li>
1105+
<li>The contents of {{DocumentOrShadowRoot}}'s <a href="#dom-documentorshadowroot-adoptedstylesheets">adoptedStyleSheets</a>'
1106+
<a href="https://heycam.github.io/webidl/#observable-array-attribute-backing-list">backing list</a>,
1107+
in array order.</li>
1108+
</ol>
1109+
1110+
To <dfn export>create a CSS style sheet</dfn>, run these steps:
11041111

11051112
<ol>
11061113
<li>Create a new <a>CSS style sheet</a> object and set its
@@ -1285,12 +1292,20 @@ represented by the collection.
12851292
<pre class=idl>
12861293
partial interface mixin DocumentOrShadowRoot {
12871294
[SameObject] readonly attribute StyleSheetList styleSheets;
1295+
attribute ObservableArray&lt;CSSStyleSheet> adoptedStyleSheets;
12881296
};
12891297
</pre>
12901298

12911299
The <dfn attribute for=DocumentOrShadowRoot>styleSheets</dfn> attribute must return a {{StyleSheetList}} collection representing
12921300
the <a>document or shadow root CSS style sheets</a>.
12931301

1302+
The <a href="https://heycam.github.io/webidl/#observable-array-attribute-set-an-indexed-value">set an indexed value</a> algorithm
1303+
for <dfn attribute for="DocumentOrShadowRoot"><code>adoptedStyleSheets</code></dfn>, given <var>value</var> and <var>index</var>, is the following:
1304+
<ol>
1305+
<li>If <var>value</var>'s <a>constructed flag</a> is not set, or its <a>constructor document</a> is not equal to this
1306+
{{DocumentOrShadowRoot}}'s <a>node document</a>, throw a "{{NotAllowedError}}" {{DOMException}}.</li>
1307+
</ol>
1308+
12941309
Style Sheet Association {#style-sheet-association}
12951310
--------------------------------------------------
12961311

0 commit comments

Comments
 (0)