Live data from Hacker News

You might not need JavaScript

youmightnotneedjs.com

101–110 of 254 posts

Re: You might not need JavaScript

#101
The biggest pain point with using :target is that location.hash, which powers it, is a single global state variable - which means you can't nest tabs inside tabs, for example.

The slider has the problem that it cannot dynamically size with the container width, and the amount of slider elements has to be known at compiletime (width: n * 100%).

File upload has the nastiness that you can not really independently style the inputbox with the filename and the button. Chrome has input[type="file"]::-webkit-file-upload-button, but I am not aware of a Firefox/IE solution. Also, you cannot combine the input[type="file"]::-webkit-file-upload-button with a general button selector in the same CSS rule, because Firefox doesn't know the ::-webkit-file-upload-button and discards the whole rule as invalid - you have to double declarate your button styles if you want uniform button look in Chrome. And, even on Chrome, you cannot visually separate the inputbox from the button (e.g. I have a 2-col layout, 320px/col and 16px margin, and I only can mess around with width, padding and margin instead of a clean separation).

To the people who whine about SASS: you can ALWAYS write the resulting CSS by hand, it just takes a boatload of manual typing.

Re: You might not need JavaScript

#104
post #52

Many of these make sense, but a few (for eg. 'View Switcher') end up obscuring the logic of what's happening, and are probably better off done in JS.

Also, some of them have major accessibility and usability issues. The image slider for example can't be paused. There's the CSS property "animation-play-state" which could have been used to do this, but that literally freezes the animation, whereas you typically don't care about the animation but don't want the slider to move on to the next image (i.e. finish the transition, then pause). And of course depending on wh…

Yeah, the slider could have an overlay label that toggles a checkbox, where the slider animated is depending upon a checked property, but then the issue is which image is active... that would get fairly complicated with css only.

Re: You might not need JavaScript

#105
post #84

Earlier quoted context omitted.

It's consistent with the platform, i.e. the alerts are native

You should experiment with these. They are different on different browsers on the same platforms.

Sure, but (unless their GUI is implemented with web technologies for some reason) they generally use native widgets, at least.

Re: You might not need JavaScript

#107
post #56

> JavaScript is great I've never heard somebody say that. Can you elaborate?

It's powerful, flexible, supports classical and functional paradigms and can handle input validation and transformation better than most languages with less code.

It's the only reasonable cross platform client/server language which is well supported.

Re: You might not need JavaScript

#108
post #45

These don't work in Safari 10: - The modal dialog example - Color picker - Form validation

And also with IE9. So what's the problem? :))

The problem is that Safari (especially mobile Safari) is actually a current, major browser [0], while IE9 thankfully is not :).

[0] http://gs.statcounter.com/#mobile+tablet-browser-ww-monthly-...

Re: You might not need JavaScript

#109
post #16

Another point of view: an exceptional article by Jenn Schiffer "A Call For Web Developers To Deprecate Their CSS" https://medium.com/cool-code-pal/a-call-for-web-developers-t... - HN Submit here https://news.ycombinator.com/item?id=12691081

That writer is amazing.

Re: You might not need JavaScript

#110

So let's show off what you can do without JavaScript...but also include SCSS as a dependency when the opening paragraph complains about a JavaScript dependency? Madness...but I digress. Some of these are cool examples. Others, like the modal, won't scale very well because now you can trigger modals by tabbing (breaks keyboard navigation) or most of the form examples as you'll likely hit many endpoints that require JS…

All you need is this motherfucking website: http://motherfuckingwebsite.com/
Post reply on HN