Unlocking the Power of Shadow DOM
summary
Defines Shadow DOM as encapsulation used by YouTube, Google Maps and Material UI and shows concrete code: uses attachShadow on a custom element, builds a button inside a shadow root, and toggles closed vs open modes. Demonstrates that open shadow roots are reachable via document.getElementById(...).shadowRoot.querySelector and can have styles changed to green while closed roots throw cannot read property errors and remain blue, proving encapsulation works. Also shows React use on refs and Angular component encapsulation.
AI-written summary · about
chapters (9)
- 0:00intro
- 0:22preamble
- 0:34what we will cover
- 0:53what is shadow dom
- 1:37popular apps using shadow dom
- 1:59reactjs
- 2:15angular
- 2:33demo
- 5:28thank you
related talks
29mInspector Web and the Mystery of the Shadow DOM
51mShining Light on the Shadow DOM
42mWorking in the Shadow (DOM) - How to test Web Components
13mGhost in the Shadow DOM
42mI Don’t Need No Stinkin’ Framework - Mastering Shadow DOM
32mFuture CSS in Web Components
29mBreak out from the framework: Web Components to the rescue
26mThe complementarity of React and Web Components
