A few weeks ago, I wrote about how I believe the Shadow DOM is an anti-pattern. This has probably been one of my most controversial articles, with a lot of folks reaching out to tell me how important it is to have CSS that they absolutely know cannot be modified by outside CSS. Let's imagine you have a Web Component that renders a button.
Let's also imagine you have a site that already has Without the Shadow DOM, you can do literally nothing and the the Web Component
With the Shadow DOM the Web Component The Web Component authors can apply their own styles inside the Web Component, and those styles apply just to the Web Component
Now, we're in a weird spot. We've either recreated our existing global styles inside the Web Component, or we have styles for our Web Component One way to address this is with CSS variables, which do pierce the Shadow DOM.
This doesn't address I'm certain there are situations where unintended CSS collisions happen. You know what else can fix that? People who write CSS knowing how to write CSS. And debug it. And fix it. Throwing increasingly complex solutions are easily solvable problems feels like two steps backwards. Cheers, Want to share this with others or read it later? View it in a browser. |
Related Post:
- SmackDown Preview: The Rock and Roman Reigns return tonight!
- Last Chance (Free Report) 25 Video Course Creation Tips
- Top Recipes for March
- Where Should You Host Your Divi Website for Optimal Performance?
- U.S. Attorney Announces Extradition of Organized Crime Leader Charged With a Murder Plot Directed From Iran Targeting a Journalist
0 Komentar untuk "[Go Make Things] Do you really want to encapsulate your CSS? (probably not)"