Skip to content

Commit e78e715

Browse files
constructable stylesheets initial draft
1 parent 47966b5 commit e78e715

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

reports/2022.html

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -426,45 +426,66 @@ <h3>Links</h3>
426426
<dt>Previous WCCG Report(s)</dt>
427427
<dd><a href="https://w3c.github.io/webcomponents-cg/index.html#constructable-stylesheets-adoptedstylesheets">2021</a></dd>
428428
<dt>GitHub issues:</dt>
429-
<dd>---</dd>
429+
<dd><a href="https://github.com/WICG/webcomponents/issues/468">WICG/webcomponents#468</a></dd>
430430
<dt>Browser positions:</dt>
431-
<dd>---</dd>
431+
<dd><a href="https://chromestatus.com/feature/5394843094220800" target="_blank">Chrome (Shipped)</a></dd>
432+
<dd><a href="https://github.com/mozilla/standards-positions/issues/103" target="_blank">Mozilla (Shipped)</a></dd>
433+
<dd><a href="https://github.com/WebKit/standards-positions/issues/42" target="_blank">Safari</a></dd>
432434
</dl>
433435
</section>
434436
<section>
435437
<h3>Description</h3>
436-
<p>---</p>
438+
<p><a href="https://wicg.github.io/construct-stylesheets/" target="_blank">Constructable Stylesheets</a> and adoptedStyleSheets enable adding styles directly to shadow roots without creating new DOM elements. Because a single stylesheet object can be adopted by multiple scopes, it also allows sharing of styles that can be centrally modified.</p>
437439
</section>
438440
<section>
439441
<h3>Status</h3>
440442
<ul>
441-
<li>---</li>
443+
<li>Partial consensus; shipped in both <a href="https://web.dev/constructable-stylesheets/" target="_blank">Chrome</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1520690" target="_blank">Firefox</a></li>
442444
</ul>
443445
</section>
444446
<section>
445447
<h3>Initial API Summary/Quick API Proposal</h3>
446-
<p>Summary or proposal based on current status; paragraph(s) and code.</p>
448+
<p>The following is <a href="https://web.dev/constructable-stylesheets/#using-constructed-stylesheets" target="_blank">an example</a> of what this would look like in practice.</p>
449+
<pre>
450+
const sheet = new CSSStyleSheet();
451+
sheet.replaceSync('a { color: red; }');
452+
453+
// Apply the stylesheet to a document:
454+
document.adoptedStyleSheets = [sheet];
455+
456+
// Apply the stylesheet to a Shadow Root:
457+
const node = document.createElement('div');
458+
const shadow = node.attachShadow({ mode: 'open' });
459+
shadow.adoptedStyleSheets = [sheet];
460+
</pre>
447461
</section>
448462
<section>
449463
<h3>Key Scenarios</h3>
450-
<p>---</p>
464+
<ul>
465+
<li>There is no effective way to share styles across components while allowing them to be centrally modified.</li>
466+
<li>Creating `&lt;style&gt;` elements for each style used in each shadow root has a measurable performance overhead.</li>
467+
<li>CSS Module Scripts, another critical feature, depends on constructible stylesheets.</li>
468+
</ul>
451469
</section>
452470
<section>
453471
<h3>Concerns</h3>
454-
<ul>
455-
<li>---</li>
456-
</ul>
472+
<p>From their standards position tracker, Safari has highlighted some of the following concerns:</p>
473+
<ul>
474+
<li>Issues related to <a href="https://github.com/WICG/construct-stylesheets/issues/45" target="_blank">race conditions</a> with adopting stylesheets and if the adoptedStyleSheets array should be directly mutable or not</li>
475+
<li>There is concern that it is <a href="https://github.com/whatwg/dom/pull/892#pullrequestreview-593774559" target="_blank">incompatible with Declarative Shadow DOM</a>.</li>
476+
<li>Outstanding questions around <a href="https://github.com/WICG/webcomponents/issues/870" target="_blank"><em>@import</em> statements in CSS Modules</a>.</li>
477+
</ul>
478+
</p>
457479
</section>
458480
<section>
459481
<h3>Dissenting Opinion</h3>
460-
<ul>
461-
<li>---</li>
462-
</ul>
482+
<li>---</li>
463483
</section>
464484
<section>
465485
<h3>Related Specs</h3>
466486
<ul>
467-
<li>---</li>
487+
<li><a href="/#declarative-shadow-dom" target="_blank">Declarative Shadow DOM</a></li>
488+
<li><a href="/#css-module-scripts" target="_blank">CSS Module Scripts</a></li>
468489
</ul>
469490
</section>
470491
<section>

0 commit comments

Comments
 (0)