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

Insert global stylesheets into document.adoptedStyleSheets #2922

Open
nolanlawson opened this issue Jul 6, 2022 · 2 comments
Open

Insert global stylesheets into document.adoptedStyleSheets #2922

nolanlawson opened this issue Jul 6, 2022 · 2 comments

Comments

@nolanlawson
Copy link
Contributor

We currently cannot insert styles to document.adoptedStyleSheets, because for backwards compatibility we need to continue appending global stylesheets as <style>s to the document.head.

However, there is some data showing that document.adoptedStyleSheets is a performance win (#2683 #2460), and it's cleaner in our code to just use one system both at the global level and at the local (shadow root) level, so it would be beneficial to use document.adoptedStyleSheets.

@nolanlawson nolanlawson changed the title Insert global styles in document.adoptedStyleSheets Insert global stylesheets into document.adoptedStyleSheets Jul 6, 2022
@nolanlawson
Copy link
Contributor Author

Well #2923 actually showed there's a slight perf improvement for using <style>s in Chrome anyway, so this may need to be re-evaluated in the future. It makes no sense to me that the ceremony of creating a DOM node just to add a style actually improves perf relative to constructable stylesheets, but maybe Chrome has optimized one case more than the other.

Copy link

git2gus bot commented Aug 19, 2024

This issue has been linked to a new work item: W-16535766

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

No branches or pull requests

1 participant