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 Stylesheet Objects (including adoptedStyleSheets) #42

Closed
thescientist13 opened this issue Jul 31, 2022 · 8 comments
Closed
Assignees
Labels
concerns: interoperability This proposal creates interop risk, e.g. due to vagueness from: Google Proposed, edited, or co-edited by Google. position: support topic: css Spec relates to CSS (Cascading Style Sheets) topic: web components venue: WICG Proposal is incubated in the Web Incubator Community Group

Comments

@thescientist13
Copy link

thescientist13 commented Jul 31, 2022

Request for position on an emerging web specification

(Please delete inapplicable rows.)

  • WebKittens who can provide input:

Information about the spec

Design reviews and vendor positions

Bugs tracking this feature

N / A

Anything else we need to know

From the WCCG's report to TPAC in 2021

Constructable Stylesheets 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.

Motivation

  • 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.
@rniwa
Copy link
Member

rniwa commented Jul 31, 2022

This feature seems to have some loose ends. What happened to this issue for example?

@rniwa
Copy link
Member

rniwa commented Jul 31, 2022

We also raised a number of concerns in WICG/construct-stylesheets#45 but I don't think all of them are adequately addressed.

@uasan
Copy link

uasan commented Aug 1, 2022

but I don't think all of them are adequately addressed.

What solution do you expect to change in the current spec for Safari to agree to implement it?

Without a native implementation in Safari, polyfill code will be executed, which gives worse performance.
Safari clients on macOS will be forced to choose any other browser because, they don't execute polyfiles which are slow and memory intensive, I think this should be fixed.

@hober hober added topic: css Spec relates to CSS (Cascading Style Sheets) topic: web components venue: WICG Proposal is incubated in the Web Incubator Community Group labels Sep 1, 2022
@othermaciej othermaciej added the from: Google Proposed, edited, or co-edited by Google. label Sep 25, 2022
@annevk annevk added the concerns: interoperability This proposal creates interop risk, e.g. due to vagueness label Oct 18, 2022
@annevk
Copy link
Contributor

annevk commented Oct 18, 2022

As of WebKit/WebKit@5de6ac4 this is implemented and enabled by default.

Per WICG/construct-stylesheets#140 however it seems like the specification has moved and the resolution of the open issues is unclear?

It's now part of https://drafts.csswg.org/cssom/ and there's at least some trivial-but-significant issues with the feature defined in that specification such as w3c/csswg-drafts#7799. As such adding concerns: interoperability.

@uasan
Copy link

uasan commented Oct 20, 2022

In version 156 of Safari Tech Preview, this is implemented.
But there is a lack of support for Implement CSS module scripts
I need to create a separate problem here?

@annevk
Copy link
Contributor

annevk commented Oct 20, 2022

CSS module scripts would be a separate topic and therefore issue, yes.

@rniwa
Copy link
Member

rniwa commented Mar 28, 2023

This feature has been implemented and shipped in WebKit as of Safari 16.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concerns: interoperability This proposal creates interop risk, e.g. due to vagueness from: Google Proposed, edited, or co-edited by Google. position: support topic: css Spec relates to CSS (Cascading Style Sheets) topic: web components venue: WICG Proposal is incubated in the Web Incubator Community Group
Development

No branches or pull requests

8 participants