在CDNJS jquery。纤细的包裹被放置。它的尺寸更小。与原作的主要区别是什么?快速查看代码并没有带来答案,在https://jquery.com我没有找到任何关于苗条包的参考资料。
那么,jquery.js和jquery.slim.js之间有什么区别呢?
在CDNJS jquery。纤细的包裹被放置。它的尺寸更小。与原作的主要区别是什么?快速查看代码并没有带来答案,在https://jquery.com我没有找到任何关于苗条包的参考资料。
那么,jquery.js和jquery.slim.js之间有什么区别呢?
当前回答
如上所述,Ajax和特效模块已经被排除在jQuery slim之外,缩小版解压后的尺寸差异为85k vs 69k(精简版节省16k)或压缩版30vs24,需要注意的是,bootstrap 4使用的是精简版jQuery,所以如果有人想要完整版,他们需要调用它
其他回答
jQuery博客,jQuery 3.1.1发布!说,
Slim build Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for all your web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. All in all, it excludes ajax, effects, and currently deprecated code. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version – 23.6k vs 30k.
当我想使用jQuery UI时,有一个很大的不同,使用jQuery的精简版本,这是不可能的。事实上,精简版不包括ajax和effects模块
我能看到美元。从jQuery中移除ajax
来自jQuery文档
你也可以使用精简版,它排除了ajax和效果模块
以下是精简版删除功能后的评论
/*! jQuery v3.2.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector | (c) JS Foundation and other contributors | jquery.org/license */
如上所述,Ajax和特效模块已经被排除在jQuery slim之外,缩小版解压后的尺寸差异为85k vs 69k(精简版节省16k)或压缩版30vs24,需要注意的是,bootstrap 4使用的是精简版jQuery,所以如果有人想要完整版,他们需要调用它
查看代码,我发现jquery.js和jquery.slim.js之间有以下差异:
在jquery.slim.js中,删除了以下特性:
jQuery.fn.extend jquery.fn.load jquery。每个(附加一堆处理常见AJAX事件的函数) jQuery.expr.filters.animated AJAX设置(jQuery.ajaxSettings。xhr, jQuery。ajaxPrefilter, jQuery。ajaxSetup, jQuery。ajaxPrefilter jQuery.ajaxTransport) XML解析,jQuery.parseXML 动画效果(jQuery。宽松,jQuery。动画,jQuery.speed)