Skip to content

Commit 79bed39

Browse files
bytestreamArkni
authored andcommittedJun 24, 2020
Core: Replaced deprecated jQuery functions
Replaced $.isArray and $.isFunction
1 parent af445b3 commit 79bed39

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎src/core.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ $.extend( $.validator, {
13131313

13141314
// Evaluate parameters
13151315
$.each( rules, function( rule, parameter ) {
1316-
rules[ rule ] = $.isFunction( parameter ) && rule !== "normalizer" ? parameter( element ) : parameter;
1316+
rules[ rule ] = typeof parameter === "function" && rule !== "normalizer" ? parameter( element ) : parameter;
13171317
} );
13181318

13191319
// Clean number parameters
@@ -1325,7 +1325,7 @@ $.extend( $.validator, {
13251325
$.each( [ "rangelength", "range" ], function() {
13261326
var parts;
13271327
if ( rules[ this ] ) {
1328-
if ( $.isArray( rules[ this ] ) ) {
1328+
if ( Array.isArray( rules[ this ] ) ) {
13291329
rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
13301330
} else if ( typeof rules[ this ] === "string" ) {
13311331
parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
@@ -1454,19 +1454,19 @@ $.extend( $.validator, {
14541454

14551455
// https://jqueryvalidation.org/minlength-method/
14561456
minlength: function( value, element, param ) {
1457-
var length = $.isArray( value ) ? value.length : this.getLength( value, element );
1457+
var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
14581458
return this.optional( element ) || length >= param;
14591459
},
14601460

14611461
// https://jqueryvalidation.org/maxlength-method/
14621462
maxlength: function( value, element, param ) {
1463-
var length = $.isArray( value ) ? value.length : this.getLength( value, element );
1463+
var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
14641464
return this.optional( element ) || length <= param;
14651465
},
14661466

14671467
// https://jqueryvalidation.org/rangelength-method/
14681468
rangelength: function( value, element, param ) {
1469-
var length = $.isArray( value ) ? value.length : this.getLength( value, element );
1469+
var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
14701470
return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
14711471
},
14721472

0 commit comments

Comments
 (0)