-
-
Save KrofDrakula/441942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// is there any reason why I can't use this pattern to replace .live | |
// in favour for .delegate? | |
(function ($) { | |
$.root = $(document); // hat tip: Cory Hart | |
// keep safe | |
$.fn._live = $.fn.live; | |
$.fn._die = $.fn.die; | |
$.fn.extend({ | |
live: function (type, fn) { | |
$.root.delegate(this.selector, type, fn); | |
return this; | |
}, | |
die: function (type, fn) { | |
$.root.undelegate(this.selector, type, fn); | |
return this; | |
} | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rewritten to use the
extend()
method. Not really necessary, but a guideline when writing plugins. Not sure about overwriting, though.