Re:Fix CSS by writing it in JavaScript
by colinramsay on Tuesday November 25, 2014 @10:32AM
(#8658086)
You can set top in CSS.
He means "top" as in "top-relative-to-scroll-position-when-the-modal-is-taller-than-the-screen-in-IE8"
Re:Fix CSS by writing it in JavaScript
by colinramsay on Tuesday November 25, 2014 @10:45AM
(#8658133)
Ah, well you'd still need something more powerful for that kind of thing to work. A constraints engine for example:
If you're going to go to the trouble of writing a CSS processor, you could at least add in some really interesting ideas.
The Cascade in CSS can be a real maintenance nightmare, and people seem to have very different ideas on how to handle encapsulation and modularization.
After a while with React, I thought it would be nice to define all styles for a component in the same location (inside my Component JavaScript). Setting the `top` property of a popup in JavaScript, but `width` or whatever in a CSS file just feels weird.
There's been some discussion about making this easier in React[1], but also resistance, so while waiting I wrote my own little library[2] (not React-specific), but it's not as feature rich as JSS.
I think that the fact that many projects[3] like this are popping up is validating the idea.