Re: [WICG/webcomponents] Declarative CSS Module Scripts (#939)

I would prefer a syntax on the `<template shadowroot>` rather than a `<style>` inside the template. The issue for us (LWC) is that we use adopted stylesheets for pure client-side rendering (for [perf reasons](https://github.com/salesforce/lwc/pull/2460)), whereas for SSR, since there is no equivalent, we emit an inline `<style>` which has to be specially handled on the client.

The main perf benefit of adopted stylesheets that I've seen in [my testing](https://github.com/WICG/construct-stylesheets/issues/94#issuecomment-832147900) is just bypassing the DOM and avoiding the cost of creating/inserting a `<style>` element (since browsers have [optimizations](https://github.com/whatwg/dom/issues/831#issuecomment-585489960) for `<style>`s inside shadow roots). So if we need to insert a `<style>` element to match SSR, then I predict the perf benefits of adopted stylesheets would go away, and you may as well use an old-school inline `<style>`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/939#issuecomment-1511857278
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/939/1511857278@github.com>

Received on Monday, 17 April 2023 18:11:14 UTC