MicrosoftEdge/MSEdgeExplainers

[Declarative Shadow DOM Style Sharing] Suggestions for improving problem statement

sorvell opened this issue · 0 comments

The main issues with using <style> in declarative Shadow DOM (DSD) are:

  1. It's not equivalent to adopting a stylesheet since the sheet is not shared between different shadowRoots. A shared sheet can be modified and any shadowRoots in which it's adopted are automatically updated. There is currently no way to do this with DSD
  2. Identical styling must be re-emitted as HTML as many times as it's used. This bloats the HTML size of the document. Some of the cost can be easily mitigated via compression and also since browsers likely optimize actual creation of stylesheets. However, the strings must be decompressed and parsed and this adds needless extra work.