2 ms·
Sure, I can switch my code to use this, but how compatible is this with common 3rd party libraries that are dependent on jquery? For example, will this run the
by latchkey 13y ago
Sure, I can switch my code to use this, but how compatible is this with common 3rd party libraries that are dependent on jquery? For example, will this run the bootstrap js code ok? If it doesn't run that code cleanly, then we are still stuck importing jquery.
- tjansen 13y agoNot at all. While some things use a similar syntax, Minified is not compatible with jQuery (and does not try to be).
- latchkey 13y agoAnyone working on a project that has the remote chance of ever including a 3rd party dependency on jquery should never use this project. Otherwise you risk ending up needing to import jquery AND this project and now you're even farther down the rabbit hole.
- lrem 13y agoThat's why it's called alternative, not a drop-in replacement. But yes, your point is valid. Also, jquery is so ubiquitous that I see no reason to steer clear of it. If you use a CDN version of it, it's most probably already in client's cache.
- LocalPCGuy 13y agoThe point about the CDN cache is not true. It is commonly claimed, but often times it is not the case that jQuery is often cached if you use a CDN. It is "sometimes" cached, and best performance for most websites is probably to concatenate and minify jQuery in with the site's JS files.
- lrem 13y agoI can see why your statement can be true, but do you have any actual data on this? Or are we both just guessing? ;) (No, I don't have data on mine, I don't even work in this field.)
- LocalPCGuy 13y agoDiscussion of the issue here (disclaimer, I started the pull request) - https://github.com/h5bp/html5-boilerplate/pull/1327 https://github.com/h5bp/html5-boilerplate/pull/1327 The basic gist is that there is great fragmentation in the cache eco-system, and so there is no guarantee that the user actually has the version of jQuery cached that you are requesting. Alex Sexton brought up in a talk at jQueryTO that there are also the time for the DNS request itself to consider in any discussion of speed, if you concatenate/minify your code it will eliminate a DNS request. Resources discussed in that page: http://statichtml.com/2011/google-ajax-libraries-caching.html http://statichtml.com/2011/google-ajax-libraries-caching.htm... http://www.stevesouders.com/blog/2011/08/17/http-archive-nine-months/ http://www.stevesouders.com/blog/2011/08/17/http-archive-nin... http://www.stevesouders.com/blog/2013/03/18/http-archive-jquery/ http://www.stevesouders.com/blog/2013/03/18/http-archive-jqu... The end conclusion was that for H5BP it didn't make sense to remove the CDN reference, but for your own site it might - you should test it and see. It also depends on your audience (will the CDN move the files closer geographically?). In the end, ~40k (gzipped) is not going to make or break your website's performance.
- glitchdout 13y agoI disagree with your assessment (and so does the majority of people on that pull request, it seems). It's always better to use a CDN because: 1. It has a chance to be already cached (specially if you use Google's CDN). 2. All browsers nowadays do 6 parallel requests per host. So using DNS prefetching with `rel=dns-prefetch` will be faster. 3. If you bundle jQuery with your site's JS files, every time you change a single JS file of your own, your users will be forced to re-download your bundled jQuery. Seems pretty inefficient to me.
- youngtaff 13y ago
- tjansen 13y agoI thought that 'alternative to jQuery or MooTools' makes it very clear that it's just a library that offers similar functionality, especially since I mentioned two completely incompatible libraries. Unfortunately I don't know any better way to describe what the library does and its scope in only a few words. "JavaScript framework" is also misleading, and "client-side JavaScript library" too generic. But I would be thankful for suggestions. And yes, if you want to use third-party libraries that use jQuery, using Minified does not make any sense. Currently it's mostly interesting if you want complete control over your JS environment and want to optimize for size.