jQuery Roundup: jQuery 1.6, JsBloat, jQuery-URL-Parser, jQuery-Retina-Plugin
jQuery 1.6 Released
jQuery 1.6 is out and they’re already accepting proposals for 1.7.
The jQuery documentation includes a section showing changes relevant to 1.6: new or changed in 1.6. There are some interesting additions:
.prop()and.removeProp()can be used to manipulate properties, which makes.attr()’s behaviour more consistentdeferred.always()adds a handler to aDeferredobject, whatever the outcome.promise()returns aPromiseobject, which helps create a richer syntax for asynchronous operations (the animation examples illustrate it well)
JsBloat and jQuery
In jquery.com uses only 34% of jQuery by Michael Bolin, the author explains how he used JsBloat to track how much of jQuery is actually used on jquery.com. An ironic example, but it’s interesting to read the thinking behind it and Michael’s arguments for using the Closure compiler.
jQuery-URL-Parser
jQuery-URL-Parser (License) by Mark Perkins is a URI parser:
var url = $.url('http://allmarkedup.com/folder/dir/index.html?item=value');
url.attr('protocol'); // returns 'http'
url.attr('path'); // returns '/folder/dir/index.html'
It can also provide quick access to string parameters:
$.url('http://allmarkedup.com?sky=blue&grass=green').param('sky'); // returns 'blue'
I have a feeling people might want to use this for their own hash fragment routing, which the plugin makes easy:
$.url('http://test.com/#sky=blue&grass=green').fparam('grass'); // returns 'green'
jQuery-Retina-Plugin
jQuery-Retina-Plugin automatically loads high resolution images if a device has Apple’s retina display.
$(function() {
$('.retina').retina({'retina-suffix': '@2x'});
});
It determines this based on window.devicePixelRatio, so it should work with other high density displays (if the device and browser sets devicePixelRatio).