3 ms·
Actually, I don't think the chainable API is terribly important. The things that keep jquery alive and well in mind are: * A convenient way to add to the DOM.
by ergothus 11y ago
Actually, I don't think the chainable API is terribly important.
The things that keep jquery alive and well in mind are:
* A convenient way to add to the DOM. While SELECTING elements has gotten way better than the Bad Old Days, ADDING elements is still painful. (one element isn't bad, but if you're trying to add, say, a UL with a number of LI elements, it's...tedious.)
* A good wrapper for Ajax calls. Not that there aren't better, but jquery has a perfectly good one. Heck, I've jqueryified a page to test calls I'm making outside of jquery because doing a call via console is...tedious.
* Promises. We'll soon have them native (and better), but for a long time jquery has been super convenient for this.
- skrebbel 11y agofor HTTP calls from the console, you might appreciate the relatively new fetch api: https://developer.mozilla.org/en/docs/Web/API/Fetch_API https://developer.mozilla.org/en/docs/Web/API/Fetch_API if you ask me, it's impressively well designed. it looks so boring and straight forward yet somehow nearly all "simple" http libraries (not to mention builtins) in nearly all popular languages are more convoluted.
- amirmansour 11y agoI'm really greatfull for the new Fetch API. For now we need to use a pollyfill for it which just uses XHR underneath. Safari and modern versions of IE/Edge are lacking support.
- ergothus 11y agoThanks! I didn't know this was actually out there yet, awesome.
- BinaryIdiot 11y ago> Actually, I don't think the chainable API is terribly important. jQuery's API is chainable; that's all I meant by it. Their API overall just simplifies everything. I'd like to see the standards committees take ideas from development trends and work to simplify the DOM API. Honestly as far as AJAX goes I really think HTTP needs to be put into the JavaScript standard itself; not just the HTML standards. It's hard finding good libraries that can make HTTP calls in the exact same way in both the browser and node (which is important to me because much of my library type code can run in either environment). I had to write this myself and while my implementation is limited it makes my life easier.
- LoSboccacc 11y agoI've recently switched from jQuery to mustache to create elements for DOM insertion; I like that a lot, especially because it works linearly like a good old library, instead of being a huge ass framework - it's a good fit for the programming model.
- DCoder 11y ago> Promises Careful with that axe... Before jQuery 3.0, its promises API is not compatible with the Promises/A+ spec: http://stackoverflow.com/q/23744612/1233508 http://stackoverflow.com/q/23744612/1233508 If you're used to jQuery's promises, you can be in for a few surprises when trying to use other libraries (or even when updating to jQuery 3).