Intro
Last year I taught Advanced JavaScript classes at the local university. One of the topics I explained was about the Shadow DOM. Since I wasn’t very familiar with it, I had to dig deeper and understand its benefits, drawbacks, and use cases. After reading more about it, I thought that more developers should get familiar with it since it’s a fascinating technology worth being in one’s toolbox.
After reading this article, you’ll learn:
what is Shadow DOM
its benefits and drawbacks
use cases and examples
What is Shadow DOM?
Shadow DOM allows developers to attach a hidden, separate DOM to an element in the regular DOM tree. The “shadow” DOM has its own separate environment. This means that the styles and scripts defined in the “shadow” DOM don’t clash with the rest of the document.
The element from the normal DOM where we attach the Shadow DOM is called Sh…
Keep reading with a 7-day free trial
Subscribe to The T-Shaped Dev to keep reading this post and get 7 days of free access to the full post archives.