@@ -114,15 +114,25 @@ jQuery.event.special.ready = {
114
114
}
115
115
} ;
116
116
117
- migratePatchAndWarnFunc ( jQuery . fn , "bind" , jQuery . fn . bind ,
118
- "pre-on-methods" , "jQuery.fn.bind() is deprecated" ) ;
119
- migratePatchAndWarnFunc ( jQuery . fn , "unbind" , jQuery . fn . unbind ,
120
- "pre-on-methods" , "jQuery.fn.unbind() is deprecated" ) ;
121
- migratePatchAndWarnFunc ( jQuery . fn , "delegate" , jQuery . fn . delegate ,
122
- "pre-on-methods" , "jQuery.fn.delegate() is deprecated" ) ;
123
- migratePatchAndWarnFunc ( jQuery . fn , "undelegate" , jQuery . fn . undelegate ,
124
- "pre-on-methods" , "jQuery.fn.undelegate() is deprecated" ) ;
125
-
117
+ // Support: jQuery <3.2.0 only
118
+ // jQuery 3.0.x & 3.1.x used to not include the deprecated module in the slim build.
119
+ // To maintain compatibility with those versions, we need to reimplement APIs
120
+ // deprecated in them.
121
+ // See https://github.com/jquery/jquery/blob/3.1.1/src/deprecated.js
122
+ migratePatchAndWarnFunc ( jQuery . fn , "bind" , function ( types , data , fn ) {
123
+ return this . on ( types , null , data , fn ) ;
124
+ } , "pre-on-methods" , "jQuery.fn.bind() is deprecated" ) ;
125
+ migratePatchAndWarnFunc ( jQuery . fn , "unbind" , function ( types , fn ) {
126
+ return this . off ( types , null , fn ) ;
127
+ } , "pre-on-methods" , "jQuery.fn.unbind() is deprecated" ) ;
128
+ migratePatchAndWarnFunc ( jQuery . fn , "delegate" , function ( selector , types , data , fn ) {
129
+ return this . on ( types , selector , data , fn ) ;
130
+ } , "pre-on-methods" , "jQuery.fn.delegate() is deprecated" ) ;
131
+ migratePatchAndWarnFunc ( jQuery . fn , "undelegate" , function ( selector , types , fn ) {
132
+ return arguments . length === 1 ?
133
+ this . off ( selector , "**" ) :
134
+ this . off ( types , selector || "**" , fn ) ;
135
+ } , "pre-on-methods" , "jQuery.fn.undelegate() is deprecated" ) ;
126
136
migratePatchAndWarnFunc ( jQuery . fn , "hover" , function ( fnOver , fnOut ) {
127
137
return this . on ( "mouseenter" , fnOver ) . on ( "mouseleave" , fnOut || fnOver ) ;
128
138
} , "pre-on-methods" , "jQuery.fn.hover() is deprecated" ) ;
0 commit comments