forked from jquery/jquery-migrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.js
43 lines (35 loc) · 1.62 KB
/
event.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {
migrateWarn,
migratePatchAndInfoFunc,
migratePatchFunc
} from "../main.js";
import "../disablePatches.js";
var oldEventAdd = jQuery.event.add;
jQuery.event.props = [];
jQuery.event.fixHooks = {};
migratePatchFunc( jQuery.event, "add", function( elem, types ) {
// This misses the multiple-types case but that seems awfully rare
if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
migrateWarn( "load-after-event",
"jQuery(window).on('load'...) called after load event occurred" );
}
return oldEventAdd.apply( this, arguments );
}, "load-after-event" );
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
function( _i, name ) {
// Handle event binding
migratePatchAndInfoFunc( jQuery.fn, name, jQuery.fn[ name ], "shorthand-deprecated-v3",
"jQuery.fn." + name + "() event shorthand is deprecated" );
} );
migratePatchAndInfoFunc( jQuery.fn, "bind", jQuery.fn.bind,
"pre-on-methods", "jQuery.fn.bind() is deprecated" );
migratePatchAndInfoFunc( jQuery.fn, "unbind", jQuery.fn.unbind,
"pre-on-methods", "jQuery.fn.unbind() is deprecated" );
migratePatchAndInfoFunc( jQuery.fn, "delegate", jQuery.fn.delegate,
"pre-on-methods", "jQuery.fn.delegate() is deprecated" );
migratePatchAndInfoFunc( jQuery.fn, "undelegate", jQuery.fn.undelegate,
"pre-on-methods", "jQuery.fn.undelegate() is deprecated" );
migratePatchAndInfoFunc( jQuery.fn, "hover", jQuery.fn.hover,
"hover", "jQuery.fn.hover() is deprecated" );