Live data from Hacker News

JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

maraksquires.com

11–20 of 36 posts

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#11
post #5

Earlier quoted context omitted.

The page does seem to be missing a "disadvantages of JSSS" section.

if used in conjunction with a traditional CSS framework and you require javascript for your page, there are really no dis-advantages. in my rich internet applications i will use traditional CSS for the initial "base" state of the application and then JSSS for all further states which are generated via JS (no page-reload)

in my rich internet applications i will use traditional CSS for the initial "base" state of the application and then JSSS for all further states which are generated via JS (no page-reload)

Why not just have the dynamic style in a separate class next to the base class it's applied to and then use jQuery.addClass?

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#13
post #10
post #2

(1) CSS frameworks work whether or not client disable Javascript. (2) Many of the problems this article's thesis lays out with CSS are solveable server-side, by preprocessing CSS.

"CSS frameworks work whether or not client disable Javascript." I've been thinking about this a lot lately and I'm not sure it's that big a concern anymore. I did a test one day and tried to get through a day with Javascript disabled and I came to the conclusion the web simply isn't usable that way. Because these days even the simple sites require Javascript because tools like dreamweaver embed javascript for menus a…

Until very recently, you were either all-in with Flash or you couldn't watch most video online. Now there's ClickToFlash. Similar things are happening with JS. Either way, it's a disadvantage of doing styles in pure JS.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#14

This will be SLOW. Also not having vars in CSS is a blessing in disguise: otherwise business logic would be built into the stylesheet by some genius and I would Auvergne to support it. No thanks.

1. jQuery and sizzle are pretty fucking fast 2. if you cant separate your business logic from your views....you have bigger problems to deal with....

1. Not as fast as C++

2. Exactly. And this simply invites someone to put in the stylesheet.

3. Debugging CSS is already not trivial due to implementation issues. As this technique still relies on CSS you will still have some of the same issues.

4. Ability to have expressions in the stylesheets has already been tried. Once. Trust me you don't want it. Testing and debugging it is very hard.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#15
> CSS is not a programming language - no variables, no functions, no logic

How is that an issue and what made you think that it was a programming language?

> CSS properties are not cross-browser compatible

Neither is the DOM. Both statements are misleading because most CSS properties are cross-browser.

> CSS frameworks (haml, sass, less) are meant for server-side templating and we need client-side templating

This is a "disadvantage" of CSS frameworks, not of CSS itself.

> dynamically including .css files in the DOM does not guarantee CSS classes will be set cross-browser

Ok? Are you talking about dynamically including them client or server-side?

This site looks rather bland considering that it is promoting a stylesheet framework. Lets take a look at the stylesheet on this very site:

    
        body {background-color:#000000; color:#FFFFFF; margin:20px;}
        a { color:#FFFFFF;}
        a:hover { color:#CCCCCC;}	
    
I guess this goes hand-in-hand with the grammar, which is also lacking.

Now lets take a look at the sample styling code:

    drip.toolbar.css = {
	  height : "40px", 
	  width : "89px", 
	  position :"fixed", 
	  right : 50, 
	  bottom : 0,
	  overflow : "hidden",
	  cursor : "pointer",
	  color : "#FEFEFE",
	  "background-color": "#932c2c",
	  "text-align" : "left",
	  "font-family" : "Arial, Helvetica, sans-serif",
	  "font-size" : "12px",

	  "#drip-toolbar-button" : {
		height : "30px",
		width : "50px",
		cursor : "pointer",
	  },
	  
	  ".links" : {
		  color : "#FEFEFE"
	  }
This is different / an improvement on CSS how? You are adding extra characters (double quotes and colon) compared to plain-old css for a more bloated stylesheet that must be downloaded? That might be considered nit-picky, but the benefit here of using JSSS is not obvious (Im still trying to figure it out).

Also, the 4 line example is actually 6:

    function parseCSS(id,css){
	  for(style in css){
		if(typeof css[style] == 'object'){parseCSS(style,css[style]);
		else{$(id).css(style,css[style]);}
	  }
	};
Comments have already been made about having javascript disabled. Perhaps a tag that would pull down REAL CSS (again, what is the point of this? I am now maintaining CSS and JSSS?) would remedy.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#16
post #9

Earlier quoted context omitted.

if used in conjunction with a traditional CSS framework and you require javascript for your page, there are really no dis-advantages. in my rich internet applications i will use traditional CSS for the initial "base" state of the application and then JSSS for all further states which are generated via JS (no page-reload)

one big drawback I'm seeing is binding styles directly to DOM elements (it will appear as style attribute). this definitely has memory (many non-shared styles) and performance implications (may cause many reflows because you are setting styles individually) and it may interfere with existing code I would expect this tool to generate real CSS stylesheet code and embed it into page dynamically

I don't think this is an issue. You're modifying the DOM directly. Those style properties exist anyway. You're just modifying them via js.

It only "appears as style attribute" if you serialize the DOM into HTML.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#17
post #15

> CSS is not a programming language - no variables, no functions, no logic How is that an issue and what made you think that it was a programming language? > CSS properties are not cross-browser compatible Neither is the DOM. Both statements are misleading because most CSS properties are cross-browser. > CSS frameworks (haml, sass, less) are meant for server-side templating and we need client-side templating This is…

Unless I'm mistaken, the point is that you can modify your styles on the fly as you wish. CSS is pretty static, apart from :hover etc. With js you're free to do what you please.

Personally I prefer to use js rather than css for rich webapps.

Re: JSON stylesheets - screw CSS frameworks, use JavaScript - JSSS

#19
post #15

> CSS is not a programming language - no variables, no functions, no logic How is that an issue and what made you think that it was a programming language? > CSS properties are not cross-browser compatible Neither is the DOM. Both statements are misleading because most CSS properties are cross-browser. > CSS frameworks (haml, sass, less) are meant for server-side templating and we need client-side templating This is…

i appreciate you took the time to read through everything and respond so throughly, but you seem to be missing the whole point.

you can try re-reading the comments on this thread but if you've never dealt with really rich javascript apps, i can see why this is hard to grasp.

Post reply on HN