Shadow DOM considered harmful
I was going to write an article about how Shadow DOM has been a horrible idea and here comes Manuel Matuzovic with an article that lays out exactly what’s wrong with it.
The article is balanced and well considered, so I’m going to feel free to be more unhinged and not mince my words when I say that Shadow DOM has been actively harmful to the web.
Let’s consider the 3 “pros” mentioned by Manuel.
- Style Encapsulation
- DOM Encapsulation
- Slots
Style Encapsulation
This is arguably the most useful part of Shadow DOM today and it is already not what most developers wanted when they asked for “scoped CSS”.
Usually, we want global styles to apply to our components. What we don’t want is styles that are only meant for our components from leaking out.
CSS will soon add true scoped selectors to CSS which is what we have wanted this whole time.
All the work and heavy-handed promoting of web...