In our last poll, we asked “What’s your take on managing styles entirely in JavaScript?”. This is a concept we wrote about in depth here and recently talked about in a panel on ShopTalk.
Over 23,000 people voted.
See the Pen Crazy Pie Chart by Chris Coyier (@chriscoyier) on CodePen.
The largest contingent, at 49%, voted “Are you insane? This is an awful idea.”. Only 6% voted “I love it. I’m all in. CSS is over.”. More people are strongly against the idea than strongly for it. But it does mean that more than half of people don’t necessarily dislike it. In fact one notch down from dislike was “It kinda rubs me the wrong way, but I’m trying to be open minded about it.” which was the second largest contingent at 26%. Next down was the favorable “I think it’s an interesting idea and makes sense in some situations.” leaving only 5% completely on the fence with “I don’t feel strongly about it either way.”
Overall I guess I’d say the response was a bit more welcoming that I would have expected on a CSS site, and the bias that evokes. The phrasing likely affected that as well, but I’m happy with it.
This poll will be particularly interesting to look at again in a year or two. I don’t have a good sense if this idea of styling only through JavaScript has legs or not. I have a fairly strong sense that CSS is far from “over” for most sites on the web, but even if we scoped it to “large, very dynamic sites” we’ll have to see where that needle is down the road a few years.
I’d like to see the results of this same poll, but restricted to people who listened to the Shoptalk panel podcast. I know it changed my mind.
Zach, is that episode 180? I’m trying to find it, but not sure which one it is in the list (https://itunes.apple.com/podcast/id493890455).
Episode 180
http://shoptalkshow.com/episodes/180-panel-on-inline-styles/
Good call! They make a good case for it – I’m definitely open to it now
Change colors and will awesome ;)
I found this results so interesting. I would like to see that pool again in year or two and see the results. I changed my mind a bit after your Shop Talks Show guys.
I still fail to see how this could ever come close to resembling a good idea, and since nobody has been able to succinctly explain why it is, I’m sticking with SASS.
I’d like to see some examples of how this JSON styling method would handle state better than CSS. It’s clear that there is more flexibility, but to what extent, and how much of an improvement does this represent?
I think the separation between the ‘working’ layer and the ‘display’ layer should at least be partially preserved. Keeping some javascript in play for the ‘display’ layer only makes sense, but an over-reliance on javascripting to do even the most basic of things, even CSS-injection, can cause major problems down the road.
I got stories about a CIO who built his own front-end/back-end framework for webapps that he was so proud of. He thought he cracked a major problem, but he never used anything in the CSS back of tricks. Once he found out how absolute positioning worked, and that javascript can measure a screen, that’s all he relied on. He built webapps that look like Windows 95 apps, ribbon and all.
He thought he was a [email protected]#[email protected]#% genius, but did insanely stupid things in his javascript. He never used :hover, instead opting to actually REPLACE objects in the DOM on hover with a different object. He called this “real” hover and called CSS command “:hover” “fake hover”. His pretentiousness knew no bounds. So, whenever I hear the idea of having javascript handle the display layer entirely, I have flashbacks on this idiot’s system of absolutely positioned objects, his definition of “real hover” and the overall clusterfuck that was his framework.
So, what the hell happened to this complete moron? Did someone finally point him in the right direction?
(Such a captivating story)
I think a very important thing that is often missed in picking a framework, like for example React, is to understand the true reason of why it was created. It is created for scale, and particular scale in an app-like UI.
If you’re not building such a thing, likely the whole paradigm is not needed for you, and may even work against you.
Therefore, I find the poll’s question too generic. The question is asked as if managing styles in JS only is a good idea as a one-size-fits-all approach to our industry, but that question is not realistic, and the answer is predictable. The real question is, in which cases, if any, is it a good idea to manage style in JS only?