Live data from Hacker News

You might not need JavaScript

youmightnotneedjs.com

221–230 of 254 posts

Re: You might not need JavaScript

#222

Earlier quoted context omitted.

Why would syntax highlighting need JavaScript?

The browser doesn't natively support syntax highlighting (they aren't features of HTML or CSS).

That hardly makes sense. Changing the color of text is definitely a feature of HTML and CSS.

What's the lazy reason for not rendering that before serving the html page.

Re: You might not need JavaScript

#223

When I was hired on the Watson team, the first thing they asked me to do was help improve performance of their AngularJS-based website. It was all-around slow, especially for the initial page view. I stripped out AngularJS and most of the other JavaScript, and published a website that was almost pure static HTML. It loaded very quickly. My manager thought it was hilarious - his "JavaScript expert" came in and deleted…

I did just that same thing for a client. They were using React to make 1 AJAX request to Foursquare. The thousands of lines of code turned into 22 lines of vanilla Javascript. I was shocked.

It reminds me of this:

https://hackernoon.com/how-it-feels-to-learn-javascript-in-2...

Re: You might not need JavaScript

#224

When I was hired on the Watson team, the first thing they asked me to do was help improve performance of their AngularJS-based website. It was all-around slow, especially for the initial page view. I stripped out AngularJS and most of the other JavaScript, and published a website that was almost pure static HTML. It loaded very quickly. My manager thought it was hilarious - his "JavaScript expert" came in and deleted…

I've had interview candidates for frontend developer positions who only know how to build web pages using frameworks like Angular and React. They don't seem to understand how those frameworks work but essentially patch together a bunch of example online to get something going. It's truly unfortunate that many beginner web development tutorial introduce these technologies first in my view. Without giving new developer…

I think it's partially an artifact of JavaScript's historical arc. Piecing together examples was maybe not best practice, but it was pretty damn good practice in the days when Jquery was best practice and in those days Jquery was best practice because browsers varied. I mean the alternative to using black boxes was to recreate Jquery.

It's also partially an artifact of JavaScript's lack of namespaces and scoping rules and prototypical inheritance because these make it easy to make a class of errors that are conceptually difficult to understand without holding a complex mental model in my head...and that's after standardization of browsers reduced the number of arbitrary rules that could cause bugs.

Re: You might not need JavaScript

#225
post #211

Earlier quoted context omitted.

I've had interview candidates for frontend developer positions who only know how to build web pages using frameworks like Angular and React. They don't seem to understand how those frameworks work but essentially patch together a bunch of example online to get something going. It's truly unfortunate that many beginner web development tutorial introduce these technologies first in my view. Without giving new developer…

How would you suggest breaking out of that silo?

Start from scratch/plain ol html. Add dependencies as you need them and for very specific purposes rather than have them "just because"

Re: You might not need JavaScript

#226
A lot of "you don't need Javascript" articles show a bunch of CSS tricks that look flashy and cool but in reality are brittle, limited, and hard to maintain. There's a fair bit of that here, but props for also pointing out some of the new HTML5 features that may have slipped under people's radars. I was aware of the form validation and I think it's a godsend, but I had no idea there's a native color picker now too.

Re: You might not need JavaScript

#228

Earlier quoted context omitted.

I've had interview candidates for frontend developer positions who only know how to build web pages using frameworks like Angular and React. They don't seem to understand how those frameworks work but essentially patch together a bunch of example online to get something going. It's truly unfortunate that many beginner web development tutorial introduce these technologies first in my view. Without giving new developer…

> only know how to build web pages using frameworks like Angular and React I've never been able to fathom how anybody can do that without understanding the foundation that it's built on. At the bare minimum, how the heck do these people troubleshoot errors? If you have so much as a typo in your code, Angular is going to give you a completely cryptic jQuery error message.

...and then Google brings you to the corresponding StackOverflow page :)

Re: You might not need JavaScript

#229

Earlier quoted context omitted.

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…

you should design your website to still be functional even if Javascript is disabled True, but irrelevant to the issue of "can you do X on the client side without Javascript?". I can imagine a Javascript form validator that somehow makes the form unusable with Javascript turned off, but I've sure never seen one. And server-side validation is website 101 stuff that you should always be doing regardless of the front-en…

I agree. Though sadly keeping your JS validation messages in sync with the ones your server produces can still be a surprisingly high amount of work and headache. Many people can think of the time it takes to build functionality like this as gold plating.

Re: You might not need JavaScript

#230
post #184

Earlier quoted context omitted.

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 w…

I agree with what you're saying, but many, and I mean many, single page web applications get used for things that are essentially Web documents.

If you're building a game or something interactive, I get it. But many SPA's are used to give database-backed forms a pretty skin. It's the overuse of Javascript in this way, and the lack of graceful degradation for forms like this when Javascript is disabled, that I think is beginning to create concern.

Post reply on HN