jQuery 1.2.3 Released
This is a bug fix release for jQuery 1.2. You can view the full list of what was fixed on the bug tracker.
Downloading
jQuery 1.2.3:
- jQuery Minified (15kb with gzipping
- jQuery Packed (29kb)
- jQuery Regular (94kb)
.data() and .removeData()
These methods complement the already included jQuery.data and jQuery.removeData methods introduced in jQuery 1.2. The important change, however, is that they’ve been tailored for plugin developers. You can now namespace data additions – like you can with event binding/unbinding. For example:
$("div").data("test", "original"); $("div").data("test.plugin", "new data"); alert( $("div").data("test") == "original" ); // true alert( $("div").data("test.plugin") == "new data" ); // true
Additionally, getting or setting data values can be overridden by a plugin. For example, the following code is from the, recently updated, draggables in jQuery UI:
$(element).bind("setData.draggable", function(event, key, value){ self.options[key] = value; }).bind("getData.draggable", function(event, key){ return self.options[key]; });
The above makes it such that all attempts to get and set draggable-namespaced data will be intercepted and handled by the plugin directly (rather than being bound directly to the element). The result is a powerful new interface for dealing with internalized data within a plugin.
.unbind(“.namespace”)
In jQuery 1.2 you could add and remove namespaced events, however you always had to include a name for the type of event being used. With this addition you can now remove all bound events that match a particular namespace, for example:
$("div").bind("click.plugin", function(){}); $("div").bind("mouseover.plugin", function(){}); $("div").unbind(".plugin"); // All handlers removed
The above removes all bound event handlers that are within the “plugin” namespace.