Open nolanlawson opened 2 years ago
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.
This issue has been linked to a new work item: W-16535766
We currently cannot insert styles to
document.adoptedStyleSheets
, because for backwards compatibility we need to continue appending global stylesheets as<style>
s to thedocument.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 usedocument.adoptedStyleSheets
.