aboutsummaryrefslogtreecommitdiffstats
path: root/src/event-alias.js
diff options
context:
space:
mode:
authorMichał Gołębiowski <m.goleb@gmail.com>2013-03-04 04:03:57 +0100
committerDave Methvin <dave.methvin@gmail.com>2013-03-25 22:06:50 -0400
commit100d3c351604e1f9641098da2e78678b4e6d9cdf (patch)
tree3d7d34d8b70cfdc7da9390f770d77a12f61576b9 /src/event-alias.js
parent84a94acae1ed7d65d91df235985e433d34486dc3 (diff)
downloadjquery-100d3c351604e1f9641098da2e78678b4e6d9cdf.tar.gz
jquery-100d3c351604e1f9641098da2e78678b4e6d9cdf.zip
moved bind, unbind, delegate & undelegate to event-alias.js; refs #13554
Diffstat (limited to 'src/event-alias.js')
-rw-r--r--src/event-alias.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/event-alias.js b/src/event-alias.js
index 0a87c5965..b1a15e840 100644
--- a/src/event-alias.js
+++ b/src/event-alias.js
@@ -10,6 +10,23 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
};
});
-jQuery.fn.hover = function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
-};
+jQuery.fn.extend({
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+ }
+});