Renovate bot | f591dcf | 2023-12-30 14:13:54 +0000 | [diff] [blame] | 1 | define( [ |
| 2 | "../core", |
| 3 | |
| 4 | "../event", |
| 5 | "../event/trigger" |
| 6 | ], function( jQuery ) { |
| 7 | |
| 8 | "use strict"; |
| 9 | |
| 10 | jQuery.fn.extend( { |
| 11 | |
| 12 | bind: function( types, data, fn ) { |
| 13 | return this.on( types, null, data, fn ); |
| 14 | }, |
| 15 | unbind: function( types, fn ) { |
| 16 | return this.off( types, null, fn ); |
| 17 | }, |
| 18 | |
| 19 | delegate: function( selector, types, data, fn ) { |
| 20 | return this.on( types, selector, data, fn ); |
| 21 | }, |
| 22 | undelegate: function( selector, types, fn ) { |
| 23 | |
| 24 | // ( namespace ) or ( selector, types [, fn] ) |
| 25 | return arguments.length === 1 ? |
| 26 | this.off( selector, "**" ) : |
| 27 | this.off( types, selector || "**", fn ); |
| 28 | }, |
| 29 | |
| 30 | hover: function( fnOver, fnOut ) { |
| 31 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
| 32 | } |
| 33 | } ); |
| 34 | |
| 35 | jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + |
| 36 | "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
| 37 | "change select submit keydown keypress keyup contextmenu" ).split( " " ), |
| 38 | function( _i, name ) { |
| 39 | |
| 40 | // Handle event binding |
| 41 | jQuery.fn[ name ] = function( data, fn ) { |
| 42 | return arguments.length > 0 ? |
| 43 | this.on( name, null, data, fn ) : |
| 44 | this.trigger( name ); |
| 45 | }; |
| 46 | } ); |
| 47 | |
| 48 | } ); |