Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructable Stylesheets & adoptedStyleSheets #204

Closed
Westbrook opened this issue Oct 12, 2022 · 8 comments
Closed

Constructable Stylesheets & adoptedStyleSheets #204

Westbrook opened this issue Oct 12, 2022 · 8 comments
Labels
accepted An accepted proposal focus-area-proposal Focus Area Proposal

Comments

@Westbrook
Copy link

Westbrook commented Oct 12, 2022

Description

Constructable Stylesheets and adoptedStyleSheets enable adding styles directly to DOM trees, e.g. document and 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.

General consensus; shipped in both Chrome and Firefox, not available in Safari

Rationale

  • There is no effective way to share styles across components while allowing them to be centrally modified.
  • Creating <style> elements for each style used in each shadow root has a measurable performance overhead.
  • CSS Module Scripts, another critical feature, depends on constructible stylesheets.

Specification

https://w3c.github.io/csswg-drafts/cssom-1/

Tests

Those including "constructable" in https://github.com/web-platform-tests/wpt/tree/master/css/cssom

@Westbrook Westbrook added the focus-area-proposal Focus Area Proposal label Oct 12, 2022
@foolip foolip moved this to Proposed in Interop 2023 Oct 12, 2022
This was referenced Oct 12, 2022
@gsnedders
Copy link
Member

@Westbrook
Copy link
Author

Interesting.

For my understanding, "csswg-drafts" feels less official, is that just my interpretation, or does this difference actually say something about the progress of this spec at large?

@jogibear9988
Copy link

Link to Webkit Bug:

https://bugs.webkit.org/show_bug.cgi?id=228684

@jogibear9988
Copy link

Maybe this Bug also:
https://bugs.webkit.org/show_bug.cgi?id=231054

@gsnedders
Copy link
Member

Interesting.

For my understanding, "csswg-drafts" feels less official, is that just my interpretation, or does this difference actually say something about the progress of this spec at large?

In principle the WICG is a group in which specifications are incubated, which then get moved into a working group (such as the CSS WG) which standardises them.

@josepharhar
Copy link

Here is some potentially additional description and rationale: https://w3c.github.io/webcomponents-cg/#constructable-stylesheets-adoptedstylesheets
Here is a WPT link which should hopefully give us the right tests: https://wpt.fyi/results/css/cssom?label=experimental&label=master&aligned&view=subtest&q=adopt%20or%20construct

@foolip
Copy link
Member

foolip commented Nov 11, 2022

In the MDN short survey on APIs & JavaScript, "Web Components (custom elements, Shadow DOM, etc.)" was the most popular choice by a fairly wide margin, selected by ~39% of survey takers.

Web Components was split into many granular proposals, and the survey results don't tell us which aspects web developers want the most, but it's fair to say that something about Web Components is important. (I'm posting this comment on each of the split proposals.)

@nairnandu nairnandu added the accepted An accepted proposal label Feb 1, 2023
@nairnandu
Copy link
Contributor

Thank you for proposing Constructable Stylesheets & adoptedStyleSheets for inclusion in Interop 2023.

We are pleased to let you know that this proposal was accepted as part of the Web Components focus area. You can follow the progress of this Focus Area on the Interop 2023 dashboard.

For an overview of our process, see the proposal selection summary. Thank you for contributing to Interop 2023!

Posted on behalf of the Interop team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted An accepted proposal focus-area-proposal Focus Area Proposal
Projects
No open projects
Status: Proposed
Development

No branches or pull requests

6 participants