Live data from Hacker News

You might not need JavaScript

youmightnotneedjs.com

181–190 of 254 posts

Re: You might not need JavaScript

#181
post #77

Earlier quoted context omitted.

Same. Didn't even knew that exists. Awesome.

Same here and it seems fucking amazing. I'm beginning to wonder how many more html-things like this I don't know about?

May be worth perusing https://developer.mozilla.org/en-US/docs/Web/HTML/Element/in... for additional attributes that are native to the input field.

Re: You might not need JavaScript

#182
post #70

What are the performance implications of using CSS animations versus Javascript? Say, if you were trying to make an application where page animations need to be extremely fast, like under 2ms for an experiment or test.

I had always assumed that CSS is faster, till I read your question. A quick search gave me this interesting link - https://css-tricks.com/myth-busting-css-animations-vs-javasc... - check it out!

Thanks for the link, a very informative read... and I've been looking for an answer on this topic for quite a while.

Re: You might not need JavaScript

#183
post #66

You might not, but you probably do. The validation examples and input types are a case in point. Even on browsers where they work, the alerts can't be styled and the behaviors can't be controlled.

The form element type is perfectly enough for frontend validation. You should do the rest on the backend anyway.

Perfect enough? Hardly. Errors aren't shown until you submit, giving you no opportunity to fix the mistake while you are there. It also only shows one error at a time. So if you have multiple errors, you fix one, everything is fine, and you don't see an error until you submit again.

> You should do the rest on the backend anyway

Well yes, you should validate on the backend, but you shouldn't wait to only validate on the backend.

This works well enough for getting things done quickly, but it's hardly a good UX, and a far cry from "perfect enough," whatever that means.

Re: You might not need JavaScript

#184

You might not, but you probably do. The validation examples and input types are a case in point. Even on browsers where they work, the alerts can't be styled and the behaviors can't be controlled.

I think a more important point is that you should design your website to still be functional even if Javascript is disabled. Why? Because some users, such as those who use Tor, may have legitimate reasons to disable Javascript execution while browsing. Another reason is that Javascript-generated content can screw up your website's SEO when crawlers visit your site. Using Javascript for your form validation is okay if…

I'd argue that single-page apps are a completely new emerging paradigm- the "web-page-as-application" rather than "web-page-as-interface-to-application" (or "webpage-as-hypertext-document", before that.) This isn't to say the previous two paradigms are bad, just that they're solving different problems. In light of that, here are a few responses to your points:

> Where JS becomes a problem is when it's used in ways where disabling it completely breaks the page... Single page web apps: I'm looking at you.

Here's my point: if you disable Javascript and navigate to a URL where a single-page app is hosted, the page isn't broken, your execution environment is. If I make a React app, then ipso facto I'm making an explicit choice to exclude folks that don't want to enable Javascript.

HOWEVER

> I think a more important point is that you should design your website to still be functional even if Javascript is disabled.

There's absolutely room on the Web for all three models: document, interface, and application. And despite my disagreement with this point when it comes to client-side applications, I definitely agree when it comes to Web documents and Web interfaces to server-side applications. (Rails muddied the water something fierce on that last one, which has been the source of uncountable headaches for me.)

Re: You might not need JavaScript

#185
JavaScript is overused today, even for stupidest things. If needs to be done in JS, you'll see God knows how many frameworks included. This idea reminded me of: youmightnotneedjquery.com

Re: You might not need JavaScript

#187
post #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/

I remember one of my dev friends showed me this when jQuery was taking off. The site has changed over the years because back in the day when I first saw it, he was railing against using too much javascript - specifically jQuery.

Re: You might not need JavaScript

#189

Earlier quoted context omitted.

One is a server-side depencency and one is a client-side dependency. Don't conflate them.

I never did conflate them. I've worked in this industry for 12 years now. I really don't get the disconnect here. I called it a dependency because it is and everyone is trying to tell me it's a different type of dependency. Well no shit but that was never my point to begin with. My point was hijacked and contorted here.

What everyone's trying to tell you is that your point is beside the point.
Post reply on HN