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 #2841

Closed
PaulHMason opened this issue May 22, 2019 · 2 comments
Closed

Constructable Stylesheets #2841

PaulHMason opened this issue May 22, 2019 · 2 comments

Comments

@PaulHMason
Copy link

Just a question about the roadmap. Are there plans to support constructable stylesheets with Shadow DOM? When using native Custom Elements the styles are repeated for multiple instances of the same element, and constructable stylesheets are a nice solution.

@Rich-Harris
Copy link
Member

Yes, I think so, once they're supported by all browsers. Though until CSS Modules are also supported, I'm not sure they have that much benefit — you still have to transport styles in JavaScript strings (unless you fetch them, leading to FOUC) and <style> tags in shadow DOM are already deduplicated, so the performance benefit is probably fairly modest.

@pascalvos
Copy link

pascalvos commented Jul 15, 2023

@Rich-Harris I think they are now supported.
they could allow removing of style tag what puts dom node creations on a diet what is something we could all realy use with webcomponents anyway
Furthermore i think its implemented everywere by now and Lit also uses this.
it could realy benefit custom-element creation through svelte.
think the api could be like parts that of css that is not dynamic be created with Constructable Stylesheets and parts that change dynamicly by injected in stylesheets since that wil make them local.
this would also make it render faster because styling is shared across the components when using Constructable Stylesheets and this will also remove flashing of content and reduce memory usage probably

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants