3 ms·
One thing I don't like about jQuery's evolution is the size. This version weights at 92K minified / 33K gzipped, which for mobile phones is a PITA.
by bad_user 15y ago
One thing I don't like about jQuery's evolution is the size. This version weights at 92K minified / 33K gzipped, which for mobile phones is a PITA.
- dmethvin 15y agoAgreed, and we plan to do something about it. There will be a jQuery blog post coming soon.
- kellishaver 15y agoI've been leaning more and more toward Zepto for mobile. It's still lacking a fair bit of jQuery's functionality, but the basics are there and the syntax is compatible. You lose a lot of IE/older browser support, but if you do some device sniffing and serve jQuery to desktops and Zepto to mobile devices, that's not really an issue.
- nicolsc 15y agoZepto is great if you're targeting iOS devices, or any webkit-based browser. But you'll need something else to handle Opera, which is 'quite' popular among mobile devices.
- alastair 15y agoWhy isn't there a tool that analyzes which functions / features of jQuery your project is using and generates a smaller library with only the stuff you need? I'm not really a developer so ignore if that's not possible / makes no sense.
- lucianof 15y agoThat plus server-side browser sniffing to serve only what the user's browser needs could result in an extremely reduced file size. But of course the PITA would then be to maintain that.
- JoachimSchipper 15y agoGoogle's Closure compiler can apparently do that.
- JonnieCache 15y agoDoesn't work on jquery. To use that functionality of the closure compiler without breaking your code, the source has to be annotated in a special way, or it has to be incredibly simple.
- JoachimSchipper 15y agoI don't know much about this, but do you mean http://code.google.com/p/closure-compiler/source/browse/trunk/contrib/externs http://code.google.com/p/closure-compiler/source/browse/trun... ? That suggests that it will be available at some point, at least...
- jonknee 15y agoThat's somewhat mitigated with the CDN version (most users won't have to download it).
- JonnieCache 15y agoThat doesn't apply in mobile though, you basically have to think as if the cache is always empty, because it usually is. Especially on iOS.
- Werba 15y agoI had split jquery 1.6 to two parts just put some code to string an then used exec, hack but work. Why eq: 1.css 14kb -250ms engine.js 12kb 250ms jquery 33kb 320ms ??? so jquery1.js 13kb - 243ms jquery2.js 14kb - 250ms So my page open 100ms faster :P
- bad_user 15y agoDude, I don't understand you. You did what? I don't think you gain anything by splitting it in 2 files. It could happen if the browser downloads the 2 files in parallel, but it can make your page load actually worse because you do not have a guarantee of parallelism (there's a limit to how many resources you can download in parallel from the same domain and adding multiple domains is not without cost because of the extra DNS lookup, which is also a big problem on mobile phones) and you're also introducing eval(). If anything, a better hack would be to load it such that it does not block the page being loaded. See a sample how it's done in this project: https://github.com/alexandru/crossdomain-requests-js/wiki/Usage https://github.com/alexandru/crossdomain-requests-js/wiki/Us...
- Werba 15y agoFirefox is 6 parlsee but my website is 3 files so http://stackoverflow.com/questions/7133749/can-i-split-jquery-into-two-files http://stackoverflow.com/questions/7133749/can-i-split-jquer...