Re:You might not need JavaScript
by acconrad on Wednesday October 12, 2016 @10:56AM
(#12693405)
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.
[ Parent
| on HN ]
It reminds me of this:
https://hackernoon.com/how-it-feels-to-learn-javascript-in-2...
"They were using React to make 1 AJAX request to Foursquare."
Did anyone get fired for that bit of programmer malpractice?
The parent comment is a freelancer. The code he corrected was almost certainly from another freelancer. And so the cycle of outsourced code continues.
Exactly this, but hey at least I know what I'm doing and the client is happy!
Or when a project includes jQuery for a single AJAX call - someone somewhere got paid for that ridiculous insight.
Re:You might not need JavaScript
by matchagaucho on Wednesday October 12, 2016 @04:57PM
(#12696357)
Given "fetch" is not yet a standard, jQuery $.ajax is actually a decent cross-browser polyfill.
I've been out of the JS world for a few years, but for a single Ajax call, why wouldn't you use XMLHttpRequest?
Re:You might not need JavaScript
by matchagaucho on Thursday October 13, 2016 @01:05PM
(#12702257)
jQuery ajax essentially is just a wrapper to XMLHttpRequest.
With some effort, the relevant jQuery methods that act as polyfills could be extracted.
However, a minified version of core jQuery is < 20Kb. A very low technical debt trade-off to support 99% of browsers.
Re:You might not need JavaScript
by truth_sentinell on Wednesday October 12, 2016 @05:43PM
(#12696640)
Why would you care about IE8 - 9 or whatever other browser you might be thinking about that has probably an infinitesimal market share?
Re:You might not need JavaScript
by Whitestrake on Thursday October 13, 2016 @12:37AM
(#12698456)
Market share might be a ridiculously small percentage overall, but it's never appropriate to dismiss compatibility outright.
Reasons to include inefficient code for compatibility reasons might include applications where maximum reach is valuable, or where the scale is so large that the "infinitesimal market share" percentage plays out into thousands of end users.
Because market share is only meaningful if you target consumers. If you write (internal or niche) web applications for e.g. schools, large companies, non-profits etc. legacy browsers can easily be > 30% of your targets.