1

If I create html template element which contains several css class definitions and then clone this template into 1000 instances using owns shadow DOMs, what happens?

I've experimented and I'm not sure if it creates also 1000 identical css class definitions in memory, what would not be efficient.

In Correct way to apply global styles into Shadow DOM is discussed duplicating of styles. Yes, all styles are applied to the elements, thus they are duplicated regardless of whether they are created using template or not. But what about class definitions? Are they shared between template instances or are they duplicated?

user2106769
  • 445
  • 5
  • 15
  • Possible duplicate of [Correct way to apply global styles into Shadow DOM](https://stackoverflow.com/questions/53244494/correct-way-to-apply-global-styles-into-shadow-dom) – Supersharp Dec 11 '18 at 11:26
  • Yes "class definitions" are related to the Shadow DOM so they will be duplicated. See also https://stackoverflow.com/a/49909313/4600982 – Supersharp Dec 12 '18 at 12:10

0 Answers0