jQuery is not an application framework. It is a toolbox — a set of utilities. If it could receive the label of “framework” at all it would be a utility or widget framework — not an application framework.
We’ll dig deeper into application frameworks, architecture, patterns, and all that juicy stuff later. For now, I just want you to have an understanding of where jQuery fits into the picture lest you stray before we get into the meat.
What does jQuery do?
It abstracts the mess that is the DOM. DOM stands for Document Object Model and consists of elements and element hierarchies that make up a web page. When manipulating elements on a page (form elements, containers, text, etc.), you somehow need to be able to find these elements, size them, position them, style them, animate them, add them, remove them, watch for events from them, and a plethora of other operations. Without jQuery, this is a mess. For one, the DOM and its APIs are quite poor in general. Second, standards love to be ambiguous and browsers love to stray from standards. jQuery abstracts this into simple-to-use APIs so you can be more efficient and waste less time dealing with browser inconsistencies and the dag-nasty that is the DOM.
jQuery also provides a great set of utilities for making ajax requests and dealing with objects, arrays, strings, and more. Many other utilities and widgets are built on top of jQuery including jQuery’s own jQuery UI.
Who uses jQuery?
jQuery is very popular. According to BuiltWith, jQuery is used on over 24 million websites. To avoid copyright infringement I won’t include their chart here, but I advise you to take a look if you’re interested. You’ll see that over half of the top 10,000 sites use jQuery and this number is growing at a very steady pace.
Content Delivery Networks
This popularity not only exemplifies itself with a thriving community but also reaps the benefits of exposure through a content delivery network. A CDN exposes assets at strategic places both geographically and network-topographically on well-tuned servers. This boils down to three points of awesome:
- The files will be delivered quickly.
- Some browsers limit the number of concurrent connections to a given hostname. A CDN will be a different hostname from that which hosts your main application assets resulting in additional concurrent pipes open for transferring data to your user’s browser.
- Browsers cache files based on their URL. If a user goes to Site A that loads its jQuery from CDN X and then navigates to Site B that also loads its jQuery from CDN X, the user’s browser will likely not have to load jQuery a second time since it can be retrieved from its cache.
Google provides the most popular CDN for jQuery. You can see the most popular libraries it hosts as well as the URLs you can use to load them here. Given that many of the web’s largest sites use the Google CDN for jQuery, it’s very likely your users will be able to take advantage of cross-site caching.
Many of the other libraries we will be talking about may not be hosted by Google, but are hosted by cdnjs.