Skip to content

Instantly share code, notes, and snippets.

@rkatic
Created November 5, 2009 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkatic/227508 to your computer and use it in GitHub Desktop.
Save rkatic/227508 to your computer and use it in GitHub Desktop.
jquery.delegate.js
(function($){
var slice = Array.prototype.slice;
$.each({
delegate: "live",
undelegate: "die"
}, function( name, original ) {
$.fn[ name ] = function( selector ) {
var $t = $(null), args = slice.call( arguments, 1 );
$t.selector = selector;
return this.each(function() {
$t.context = this;
$t[ original ].apply( $t, args );
});
};
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment