Web Components use of the shadow DOM is designed for this very use case.
I never have to worry about clashes or getting too cute with my naming conventions. You can just use a h1 selector and not think about it.
I never have to worry about clashes or getting too cute with my naming conventions. You can just use a h1 selector and not think about it.
FWIW if you are interested in Web Components I would say Lit is hands down the best entry point I’ve come across. Strong recommendation and nullifies most of the common complaints you tend to hear associated with them.
And here's an experiment I'm working on, where all styles are scoped to components because all static DOM trees become custom elements with their own shadow root: https://github.com/aalin/rdom