▲ | brazukadev 7 days ago | |||||||||||||||||||||||||
> - Open styleable shadow roots What people using web components want is to get rid of shadowDOM and not feel like they are deviating from the correct path. shadowDOM sucks, stop trying to convince the world that we are using it wrong. shadowDOM is the whole reason web components did not become mainstream (yet?). | ||||||||||||||||||||||||||
▲ | Ruphin 7 days ago | parent | next [-] | |||||||||||||||||||||||||
Nothing in Web Components is forcing you to use ShadowDOM. Lit also allows you to make components without ShadowDOM if you prefer, because there are certainly cases where it can be necessary to do so (like for ARIA reference id-matching). For full single application development, it can feel like it gets in the way a lot, and you can make a good argument to use components without ShadowDOM in those contexts too. All frontend "frameworks" do have some sort of solution to scope CSS to individual components, and without a similar solution, a native component system would not be viable. The implementation has its quirks, but it is a core capability that is necessary for some use cases. For third-party widgets or cross-application components like design systems, the ability to isolate your component from the site it is embedded in is very useful. Think of shadowDOM as the web component alternative to scoped styles in Vue components (as an example). You don't have to use it, but it would be incredibly inconvenient if it wasn't included in the framework. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | dtagames 7 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
I disagree completely. Shadow DOM is a huge help and when combined with per-component CSS using the :host() and nesting pattern, makes for very small CSS files and very short CSS class names. In other words, as far away from Tailwind as you can get. It's also possible to import shared CSS in a base class and add it with super.styles() so you don't lose anything. | ||||||||||||||||||||||||||
▲ | mock-possum 7 days ago | parent | prev [-] | |||||||||||||||||||||||||
What about shadow dom sucks? How else do you achieve that level of encapsulation to enable portable components? | ||||||||||||||||||||||||||
|