> If you use javascript for layout, you're gonna have a bad time.
I don't think this is necessarily true across the board. If you're creating just another brochure site then CSS does a good job of document layout and it's true that usign JS for layout is unnecessary and counter productive.
If, on the other hand, you're creating complex layouts that mimic desktop applications (complex components, nested panels etc), then JS for layout is the only sane option.
This is difficult to discuss in abstracts. "Javascript for layout" is much too vague, because of course everything is using a mishmash of javascript states, CSS media queries, and JSON content.
I think what you're referring to is using javascript to build flexible layouts that afford a significant matrix of collisions between elements (w/ variable dimensions) by programmatically evaluating, resizing, moving, etc. For example, desktop Chrome's tabs: shrinking them as they increase in number, adjusting their position to keep the close button under the mouse, etc.
But I'm having a hard time thinking of such beasts on the web, where such complications can't (or shouldn't) be limited by design. Share some examples?
These layouts all use a combination of CSS for layout (floats, margin, padding etc) as well as absolutely positioned elements that are controlled using some variety of layout manager. Where this becomes especially useful is for collapsible, resizable, movable panels and windows.
A testament to the way in which CSS is lacking is evidenced through the hundreds of multi-thousand word blog posts that were devoted over the years to discussing how to achieve multi-column equal height flexible layouts [1]. This is something that should be trivial, instead hundreds of man years have been wasted trying to get boxes to line up nicely.
CSS3 flexbox solves some of these issues, however there is still no way in which to arbitrarily constrain or anchor any container to any other container which ultimately limits its usefulness.
I don't think this is necessarily true across the board. If you're creating just another brochure site then CSS does a good job of document layout and it's true that usign JS for layout is unnecessary and counter productive.
If, on the other hand, you're creating complex layouts that mimic desktop applications (complex components, nested panels etc), then JS for layout is the only sane option.