Live data from Hacker News

CSS is powerful, you can do a lot of things without JS

github.com

111–120 of 319 posts

Re: CSS is powerful, you can do a lot of things without JS

#111

Traditionally, I remember the rule that presentation should be managed by css, while behavior should be managed by javascript. But does the fact that some things can be reasonably done either way change - for example - a site's or app's maintainability? How about it performance? Is a CSS implementation rendered faster than javascript? I struggle with this at times, especially in some cases where - admittedly older -…

CSS animations and behaviors can be rendered outside the main JavaScript thread whereas JavaScript based animations cannot.

Re: CSS is powerful, you can do a lot of things without JS

#112

Earlier quoted context omitted.

Building web applications with screens that have complex workflows and state is a need that is largely ignored by browsers and web standards. Instead of getting reusable gui components we get indechiperable css hacks that were built for creating art installations on the web rather than getting any actual work done.

Mozilla (including Firefox) had XUL, but nobody cared.

> Mozilla (including Firefox) had XUL, but nobody cared.

Have you seen XUL? Here's an example, from https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Tu...

    
    
    
    
      
      
    
    
All that does is display a window with two buttons. You can imagine how hideous it could get when it got more complex. Now, imagine this alternative (I'm assuming that id & title are mandatory arguments, and that orient is optional, default to horizontal):

    (sul
     (stylesheet "chrome://global/skin" "text/css")
     (window "findfile-window" "Find Files"
             (button "find-button" "Find")
             (button "cancel-button" "Cancel")))
Which would you rather write in?

Now, imagine that JavaScript were Scheme or Lisp instead, so that your browser interaction code were also written in an s-expression language. And imagine that CSS were s-expression-based, so that you were using the same tools to manipulate the same data everywhere.

It makes me weep.

Re: CSS is powerful, you can do a lot of things without JS

#115

Whenever someone makes a menu with CSS instead of javascript i go crazy as a user. The lack of delay is such a frustration.

> Whenever someone makes a menu with CSS instead of javascript i go crazy as a user. The lack of delay is such a frustration.

You like sluggishness?

Whenever I see a menu with CSS, I'm delighted: it means I needn't enable JavaScript (which opens up my computer to infection) just in order to read a list of links.

Re: CSS is powerful, you can do a lot of things without JS

#116
post #102

Is it possible to display a "There are no records" message if a container is empty (i.e. tbody) using CSS only?

There is an :empty state you can use. I'm not looking at the demo right now but I've added messages like this: .container:empty:before { content: 'There are no Messages' }

Just be aware that the element really has to be empty - any whitespace (including empty child tags etc.) makes the selector ignore it.

Re: CSS is powerful, you can do a lot of things without JS

#117
post #56

Earlier quoted context omitted.

Ah! I read the parent's post as sarcastic. But you are right, a little delay can be good.

There's a lot more to this than just "a little delay" to avoid accidental triggers. Good menus are complex. In desktop toolkits, there is a lot of logic to ensure they are accessible and don't behave in annoying ways. For example, a high quality menu will have a certain leeway to trigger into and out of submenus so that you don't accidentally drift into the incorrect submenu should you make an error of a couple of pi…

Good points, but surely all that knowledge could be encoded once into some CSS attributes, rather then rewritten every time for every JavaScript framework on every site?

Re: CSS is powerful, you can do a lot of things without JS

#118
post #92
post #81

Earlier quoted context omitted.

Hmmm... .accordion .content { padding:0 10px; overflow:hidden; border:1px solid #fff; -webkit-transition: all .5s ease-out; -moz-transition: all .5s ease-out; } -webkit-transition, -moz-transition... it's like we're at 180 degrees to where the web was in the days of IE4-6

Remember when Good Developers would hate on framesets because they break the back button and linking and everything? Now it's totally OK to break all that with AJAX and "text-as-apps"... I much prefer the days of the old web.

I have to maintain a web interface with framesets and it's much worse than the React stuff I build. Yes it's "one huge js-dependant page for everything", but it can keep track or where it is (and go back to it) using location.hash or path entirely (if the webserver agrees). So I can fix single page apps, I can't fix framesets.

Re: CSS is powerful, you can do a lot of things without JS

#119
post #92

Earlier quoted context omitted.

Remember when Good Developers would hate on framesets because they break the back button and linking and everything? Now it's totally OK to break all that with AJAX and "text-as-apps"... I much prefer the days of the old web.

Days of the old web where flash was pervasive and best viewed in [IE6|Netscape|Mosaic|...] pages were everywhere. Every generation of the web has had really crappy devs building bad experiences. The current generation is not making anything worse than it's predecessor.

>... is not making anything worse...

That's a pretty low bar.

Re: CSS is powerful, you can do a lot of things without JS

#120
post #92
post #81

Earlier quoted context omitted.

Hmmm... .accordion .content { padding:0 10px; overflow:hidden; border:1px solid #fff; -webkit-transition: all .5s ease-out; -moz-transition: all .5s ease-out; } -webkit-transition, -moz-transition... it's like we're at 180 degrees to where the web was in the days of IE4-6

Remember when Good Developers would hate on framesets because they break the back button and linking and everything? Now it's totally OK to break all that with AJAX and "text-as-apps"... I much prefer the days of the old web.

I would strongly disagree with "totally OK".

A crappy, lazy developer won't care about state history. A good developer will. You can do things right if you want to. It's more work but not a huge amount more.

Post reply on HN