3 ms·
Web components provide a clean abstraction boundary. You can add additional methods to your own tags which can encapsulate the logic for updating the data in th
by vaylian 1y ago
Web components provide a clean abstraction boundary. You can add additional methods to your own tags which can encapsulate the logic for updating the data in the component.
- benatkin 1y agoThey 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.