At CDNJS jquery.slim package is placed. It has a smaller size. What are the major differences from an original? A quick look at the code didn't bring the answer, and at the jquery.com I've not found any reference about slim
package.
So, what are the differences between jquery.js and jquery.slim.js ?
The jQuery blog, jQuery 3.1.1 Released!, says,
The short answer taken from the announcement of jQuery 3.0 Final Release :
The file size (gzipped) is about 6k smaller, 23.6k vs 30k.
Looking at the code I found the following differences between jquery.js and jquery.slim.js:
In the jquery.slim.js, the following function of code are removed:
I could see
$.ajax
is removed from jQuery slim 3.2.1Below is the comment from the slim version with the features removed
As noted the Ajax and effects modules have been excluded from jQuery slim the size difference as of 3.3.1 for the minified version unzipped is 85k vs 69k (16k saving for slim) or 30vs24 for zipped, it is important to note that bootstrap 4 uses the slim jQuery so if someone wants the full version they need to call that instead
At this time, the most authoritative answer appears to be in this issue, which states "it is a custom build of jQuery that excludes effects, ajax, and deprecated code." Details will be announced with jQuery 3.0.
I suspect that the rationale for excluding these components of the jQuery library is in recognition of the increasingly common scenario of jQuery being used in conjunction with another JS framework like Angular or React. In these cases, the usage of jQuery is primarily for DOM traversal and manipulation, so leaving out those components that are either obsolete or are provided by the framework gains about a 20% reduction in file size.