Core: Use named exports in `src/`
[jquery.git] / src / deprecated / event.js
blobf481a9c1f17e1d7bee08ec77688a6c491d6cb7e0
1 import { jQuery } from "../core.js";
3 import "../event.js";
4 import "../event/trigger.js";
6 jQuery.fn.extend( {
8         bind: function( types, data, fn ) {
9                 return this.on( types, null, data, fn );
10         },
11         unbind: function( types, fn ) {
12                 return this.off( types, null, fn );
13         },
15         delegate: function( selector, types, data, fn ) {
16                 return this.on( types, selector, data, fn );
17         },
18         undelegate: function( selector, types, fn ) {
20                 // ( namespace ) or ( selector, types [, fn] )
21                 return arguments.length === 1 ?
22                         this.off( selector, "**" ) :
23                         this.off( types, selector || "**", fn );
24         },
26         hover: function( fnOver, fnOut ) {
27                 return this
28                         .on( "mouseenter", fnOver )
29                         .on( "mouseleave", fnOut || fnOver );
30         }
31 } );
33 jQuery.each(
34         ( "blur focus focusin focusout resize scroll click dblclick " +
35         "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
36         "change select submit keydown keypress keyup contextmenu" ).split( " " ),
37         function( _i, name ) {
39                 // Handle event binding
40                 jQuery.fn[ name ] = function( data, fn ) {
41                         return arguments.length > 0 ?
42                                 this.on( name, null, data, fn ) :
43                                 this.trigger( name );
44                 };
45         }