This post originated from an RSS feed registered with Web Buzz
by Douglas Clifton.
Original Post: Google Code: Ajax Libraries API
Feed Title: blogZero
Feed URL: http://loadaveragezero.com/app/s9y/index.php?/feeds/index.rss1
Feed Description: Web Development News, Culture and Opinion
No sooner had I added Dave Shea's (of mezzoblue fame) excellent (if somewhat dated) CSS Sprites ALA article to my CSS resources category, then what does he go and do?
CSS Sprites Redux
You guessed it, he publishes a follow-up article. The reason I went looking for it in the first place, or rather found it to be the best write-up on the topic, was not so much the how, but the why of using this technique. But he kind of missed the point. Sure, he explains the ins and outs and a bit of the history of sprites, but for my money the single best reason to consider using it is the huge reduction in the number of HTTP requests you serve up when storing a bunch of similar iconic images in one master file. Once the browser downloads the single file and caches it, it's a simple matter of some integer offset math to display only that portion you need as a background image in your documents.
The latest version of the article takes the technique a step further by introducing some animation effects via John Resig's outstanding jQuery JavaScript library. But Dave misses the original point again, which I found ironic after he warns his audience that using jQuery imparts a certain overhead when downloading the library for the first time.
Ajax Libraries API
However, I did learn something interesting here. Google Code is now hosting jQuery as part of their Ajax Libraries API project, so you can link to it without having to host it yourself. This has two benefits, it saves you a little bandwidth, but more importantly, if enough developers are doing this then chances are your visitors already have a copy of jQuery cached locally. You can also take advantage of the Google CDN if you're using Prototype, script.aculo.us, MooTools/moo.fx, or Dojo.
google.load()
Personally, I don't understand the advantage of using the google.load() method unless you plan on using the Maps, Search, or Ajax Feed APIs. Why not just load the library and start using jQuery (or whatever) like you normally would?