Live data from Hacker News

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

github.com

221–230 of 319 posts

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

#221

Earlier quoted context omitted.

> Ah! Also, nobody cares about unobtrusive JavaScript anymore. I do. I also care about graceful degradation. There are certain times (e.g. Web Apps like Gmail) where graceful degradation is almost impossible and unobtrusive JavaScript would be silly but those are the exception. Most sites on the web are just content and there's no reason to have excessive JavaScript or any reason why the page can't be perfectly funct…

Just because something can be done a certain way doesn't mean it should be done a certain way. Minimizing javascript for the sake of minimizing it is silly. People that disable javascript represent a tiny percentage of the population. No one is going to make engineering decisions based on that tiny percentage, anymore than people still target IE6.

Yeah, who cares about people using screen readers! Or search engines...

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

#222
post #142

Earlier quoted context omitted.

That's fine. Nobody forces you to use my applications and websites.

Until you work for a government agency. Or the only supplier of a certain important service in an area. Etc.

Until your agency's spec goes among the lines of "UI implemented in modern technologies (eg. React.js, Angular, Ember.js)".

And no, I'm not making this up.

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

#223
post #212

Earlier quoted context omitted.

Is jQuery included in those 4 or 5 lines? One line of CSS in your accordion?

If you had read the next sentence of my comments you would have seen that it would be a "few more lines" if you didn't use jQuery, basically you need a function like: function eachItem(arrayLike, cb) { return [].slice.call(arrayLike).forEach(cb); } So 3 more lines. If I said you can write a very verbose accordion in under 20 lines would that be good enough for you?

>> So 3 more lines. If I said you can write a very verbose accordion in under 20 lines would that be good enough for you?

Since that's more realistic, yes that would do nicely.

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

#224

Earlier quoted context omitted.

I'm interested in seeing these 3 lines of Javascript that can implement an accordion. With a sane limit to number of characters on each line as well.

If one is already using jQuery - https://jsfiddle.net/jw75xznb/ Yeah, it's incredibly crude but it is 3 lines and it took approximately 60 seconds.

If it involves jQuery then it is not 3 lines. The original claim was 3 lines of Javascript. Making a claim something is only 3 lines of Javascript without including the fact that jQuery is required is a disservice to the many people that made jQuery the wonderful library that it is. That is the source of my disagreement.

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

#225

Earlier quoted context omitted.

If one is already using jQuery - https://jsfiddle.net/jw75xznb/ Yeah, it's incredibly crude but it is 3 lines and it took approximately 60 seconds.

If it involves jQuery then it is not 3 lines. The original claim was 3 lines of Javascript. Making a claim something is only 3 lines of Javascript without including the fact that jQuery is required is a disservice to the many people that made jQuery the wonderful library that it is. That is the source of my disagreement.

That isn't a disservice to jquery. The fact that people don't explicitly mention it could actually be viewed as a demonstration of its ubiquity.

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

#227
post #117

Earlier quoted context omitted.

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?

Could be. And polyfilled for the monstrosity that is IE. That's a huge pie in the sky - whereas with JS, that's something which has already been here for at least a decade.

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

#228

Earlier quoted context omitted.

If one is already using jQuery - https://jsfiddle.net/jw75xznb/ Yeah, it's incredibly crude but it is 3 lines and it took approximately 60 seconds.

If it involves jQuery then it is not 3 lines. The original claim was 3 lines of Javascript. Making a claim something is only 3 lines of Javascript without including the fact that jQuery is required is a disservice to the many people that made jQuery the wonderful library that it is. That is the source of my disagreement.

You're being disingenuous. Firstly, "3 lines of Javascript" wasn't meant to be taken literally. Not only that but 73% of the top 100,000 websites use jQuery - if you are on a large web development project you are more likely than not using jQuery.

[1] http://trends.builtwith.com/javascript/jQuery

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

#230
post #89

Related, does anyone else have a preferred pure css treeview?

Preferably one which does not require me to mouse down precisely to a 20px tall target, make a 90 degree turn, mouse right to another tiny target, turn again, repeat? And does not disappear on the tiniest error, making me go through the whole ordeal again?

Also, keyboard support would be great. And if it wouldn't overflow offscreen.

Oh wait, no such thing.

(Note that these are basic issues, not arcane requests for 9-bit EBCDIC compatibility - but nooooo: let the users suffer, because we want to use this extra-cool trick)

Post reply on HN