4 ms·
They let you encapsulate the logic pretty much however you want, same as not using web components.
by benatkin 1y ago
They let you encapsulate the logic pretty much however you want, same as not using web components.
- vaylian 1y agoWhen you call document.querySelector("something") in the main HTML document, it will not find "something" inside the internal HTML of a web component.
- benatkin 1y agoYou can use the shadow DOM outside of custom elements, and can use custom elements without a shadow DOM. Edit: I just added a shadow root to a div in your comment, saving its content beforehand, moved its content inside the shadow root, and added a style with * { all: initial } and your comment text got Times New Roman.