Re:jQuery 3.0 Released
by tomchristie on Friday June 10, 2016 @09:49AM
(#11876286)
> useful methods such as ajax() (no, in vanilla js it's not "solved")
Right - I use jQuery because I've greater confidence that `.ajax()` will behave correctly across a wide range of browser versions, though I don't have any good evidence about using that vs vanilla `XMLHttpRequest` these days. I'd be interested to know which bits of "not solved" - which aspects in particular are not yet well supported?
Re:jQuery 3.0 Released
by franciscop on Friday June 10, 2016 @10:48AM
(#11876699)
It's not only about criss-browser, it's about the simplicity of
ajax('/api/users', function(){}, 'json');
(of course, if you want to know about compatibility, http://caniuse.com/#search=xmlhttprequest )
What about fetch?
Fetch has its own issues - not being able to abort a fetch, or recieve progress notifications are frustrating if you require them.
But the deficiencies of fetch() are another topic entirely, and I tend to use it (polyfilled tbh) for the majority of my async requests because I like the rest of its implementation.
Then as I continued adding useful methods such as ajax() (no, in vanilla js it's not "solved") and turning events off (also non-trivial) I ended up with a jquery alternative:
> http://umbrellajs.com/
It's not exactly the same, but most methods are the same or highly compatible. For example, the append() method is extended so this does what you'd expect it to do, generate a list with first, second and third items:
u('<ul>').append(text => `<li>${text}</li>`, ['first', 'second', 'third']);