News for hackers. Stuff that matters.
Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by tptacek on Monday December 21, 2009 @06:09PM (#1008831)
(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.

Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by SamAtt on Monday December 21, 2009 @06:48PM (#1008921)
"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 and other basic animations.

Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by windsurfer on Monday December 21, 2009 @07:23PM (#1009007)
There's a good chunk of people using NoScript. By forcing people to use javascript, you're making the barrier of entry higher for those people.

Sometimes, when I see a page completely broken because it requires javascript, I just close the tab. If it's too much trouble to get your pages, which might only have static text or other elements that don't require anything fancy, to work without javascript, it's probably not worth my time to check out your page.

Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by tptacek on Monday December 21, 2009 @06:56PM (#1008939)
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 -... by axod on Monday December 21, 2009 @07:17PM (#1008997)
And it's a disadvantage to using CSS if the user has disabled CSS :/ I'm not sure why that argument is relevant. Fact is, 99%+ will have CSS and JS enabled.
Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by mdg on Monday December 21, 2009 @07:27PM (#1009014)
Sites still function without CSS. The same cant be said for poorly coded sites and javascript. I do agree this is mostly a non-issue though.
Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by robotron on Monday December 21, 2009 @06:16PM (#1008853)
The page does seem to be missing a "disadvantages of JSSS" section.
Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by JimBastard on Monday December 21, 2009 @06:20PM (#1008865)
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)

Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by dasil003 on Monday December 21, 2009 @06:48PM (#1008922)
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 -... by JimBastard on Monday December 21, 2009 @07:17PM (#1008996)
you could implement a parser that used .addClass() and .removeClass() instead of .css()

if i release an official parser i think it would use those methods.

the whole point is to store your CSS in JSON and parse it with JS, the libraries used to do the parsing / assigning are kinda arbitrary.

Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by woid on Monday December 21, 2009 @06:41PM (#1008906)
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

Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by axod on Monday December 21, 2009 @07:06PM (#1008969)
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 -... by woid on Tuesday December 22, 2009 @04:04AM (#1009637)
Have you ever looked at any open-source browser implementation?

Because of cascading nature of style definition. Data structures describing current styling form trees (for memory efficiency and easy manipulation from script). Effective styles are evaluated during rendering.

For example look at this talk and around 11:30 the guy is describing style-related data structure in Chrome/WebKit: http://www.youtube.com/watch?v=RVnARGhhs9w

Your statement "Those style properties exist anyway" is simply not true.

Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by JimBastard on Monday December 21, 2009 @06:12PM (#1008844)
as the article states, "CSS frameworks (haml, sass, less) are meant for server-side templating and we need client-side templating."

this is intended for client-side templating and dynamically assigning CSS classes and properties at run-time.

:-)

Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by tptacek on Monday December 21, 2009 @06:15PM (#1008851)
That reasoning is kind of circular, isn't it? Why do you need client-side stylesheet dynamism?
Re:JSON stylesheets - screw CSS frameworks, use JavaScript -... by axod on Monday December 21, 2009 @07:14PM (#1008989)
So you can allow styles to update without a page reload?

For example, on Mibbit, you can skin your client how you like. You just open a prefs screen and mess with colors, fonts, backgrounds, etc.

Using css for that would be ridiculous. Hence client side styling via js.