Personally, I agree that deviating from CSS syntax is not a viable solution for a large number of cases, and neither of those solutions is perfect. I just think it's cool that people are experimenting with different ways of creating collision-resistant styling tools, rather than sticking w/ the status quo.
Scoped CSS[1] would have been a good start, but unfortunately it looks to be in trouble (removed from Chrome).[2]
[1] https://html.spec.whatwg.org/multipage/semantics.html#attr-s... [2] https://www.chromestatus.com/features/5374137958662144
You can't have proper modules that you just plugin in. I want a button styled a way... it will mix with some other default button. I have to create many button classes.
But you can have proper modules that you just plugin. If you plop in your button and it conflicts with someone else's button; then one of you did it wrong. The solution is to create multiple button classes as you say, but this Javascript solution does the exact same thing.
But with this lib I don't care about classes. I just put thing in, and I have 0 conflicts. I can do whatever I want and no conflicts. Try that in css. Also take a look at react.js this lib is perfect fit for that.
The most common answer I've seen is "because I don't want to learn CSS", which I don't feel is a good enough answer.
I can write CSS all day using classes that do not conflict in the manner described.
I would be the first to agree that there are problems with CSS, I use it nearly every day and I run into these problems quite a lot. But moving to the JS to attempt to solve these problems is taking several steps backwards to me.
All the problems you list in your example I would say exist as potential problems in any other aspect of a large-scale project. In most of the examples I've seen the problem seems to be giving developers who don't know CSS access to CSS and then wonder why it eventually falls apart.