3 ms·
This happened because CSS and HTML are a totally broken model, useless for writing larger applications. They don't provide any sort of modularity / encapsulatio
by spion 11y ago
This happened because CSS and HTML are a totally broken model, useless for writing larger applications. They don't provide any sort of modularity / encapsulation - everything is in the open, present inside one big giant namespace with class names colliding with other class names and styles cascading through / being inherited by everything you want or don't want.
Web Components / HTML Imports kind of solve this though, but they're still not there. http://caniuse.com/#search=components http://caniuse.com/#search=components
JavaScript has lexical scope, and that pretty much solves everything. CSS styles are now local variables and need to be passed around. Components are not just a dump of HTML, but opaque functions - their inner structure cannot be (accidentaly) accessed by outside components. Ah - finally, a sensible programming model.
Just imagine what would be possible if CSS class names were lexical, not global strings - and you could import them into HTML (perhaps with renaming). How big of a change that would be in terms of making things easier to separate.
Well... React users got tired of imagining things :) http://glenmaddern.com/articles/css-modules http://glenmaddern.com/articles/css-modules
- spion 11y agoOf course Web Components solve it by reinventing all the possible wheels. Tim forbid that we get standard lexical scope and parameter passing.