Debian Codegraph @

vendor/static/jquery/src/deprecated/event.js

raw
1 import { jQuery } from "../core.js";
2
3 import "../event.js";
4 import "../event/trigger.js";
5
6 jQuery.fn.extend( {
7
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 },
14
15 delegate: function( selector, types, data, fn ) {
16 return this.on( types, selector, data, fn );
17 },
18 undelegate: function( selector, types, fn ) {
19
20 // ( namespace ) or ( selector, types [, fn] )
21 return arguments.length === 1 ?
22 this.off( selector, "**" ) :
23 this.off( types, selector || "**", fn );
24 },
25
26 hover: function( fnOver, fnOut ) {
27 return this
28 .on( "mouseenter", fnOver )
29 .on( "mouseleave", fnOut || fnOver );
30 }
31 } );
32
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 ) {
38
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 }
46 );