Last week, Pippin Williamson published a post titled “Why Loading Your Own jQuery is Irresponsible.” This very issues was brought up tonight at the Seattle WordPress meetup, which led to a lively discussion and referenced Pippin’s post. Please, for the love of the WordPress community, just use the version of jQuery bundled in WordPress core…
However, if you’re going to load jQuery irresponsibly, don’t do it such a half hearted way by loading whichever version of jQuery is the latest at the time! Throw caution to the wind and use the new “Random jQuery” plugin! It loads a random version of jQuery from Google’s CDN with no fallback! It supports versions 1.2.3 all the way through 1.9.1! Also it will save people hours of work because rather than being forced to debug a theme that hard coded it’s own version of jQuery, troubleshooters can simply deactivate the plugin! It’s a win/win for everyone! Yes, I did just use an exclamation point at the end of every sentence in this entire paragraph!
That is so horrible… it’s wonderful.
I wasn’t at the meetup but this has puzzled me for ages. There seems to be a rising number of premium themes that take the trouble to deregister WP’s version and install their own, or load the latest version through Google.
I’ve kinda felt there must be some sensible reason for doing this that I didn’t know of – after all, these theme developers were earning money from these themes… they must know something that I didn’t. Even though (to me) it seemed to be a silly thing to do. I’m sure plenty of developers have seen ‘professionals’ doing this and adopted the same technique in their own code… assuming it must be the right thing to do.
Having said that, I don’t think I’ve worked on modifying a single premium theme where I haven’t found at least one bug, so I don’t know why I hold them up as perfect in other areas!
Technically, loading jQuery from Google’s CDN should be faster, which might be the reason so many developers do it. However, it also prevents jQuery from loading properly in countries like China that block access to Google. It’s really sad that it’s so common.