4 ms·
Yes, but not directly (jQuery is not written in a compatible way for dead code removal). Instead, use https://github.com/zgrossbart/jslim https://github.com/zgr
by ehsanu1 14y ago
Yes, but not directly (jQuery is not written in a compatible way for dead code removal). Instead, use https://github.com/zgrossbart/jslim https://github.com/zgrossbart/jslim
- buddydvd 14y agoThis is great. Thanks for the link! The example in the readme suggests that jslim can reduce simple apps combined with jQuery by up 28%. I wonder if it can achieve more if jQuery was modified to let you specify selectors by function calls instead of selector string. For calls like $("a.button"), the static analyzer may have trouble removing unused code such as the parts that deal with descendant selector, ID selector. If selectors where specified as function calls like $.find($.byTag("a").byClass("button")), static analyzer may identify and remove more dead code. Though it probably isn't worth the effort if the code requires such drastic modifications.