fix: Replace some deprecated jQuery with recommended replacements (#4607)

This commit is contained in:
Lars Eggert 2022-10-19 22:36:15 +03:00 committed by GitHub
parent cf033352b4
commit 76b88b1658
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,7 +61,7 @@
replace: function(new_array){ replace: function(new_array){
if (!new_array) if (!new_array)
return; return;
if (!$.isArray(new_array)) if (!Array.isArray(new_array))
new_array = [new_array]; new_array = [new_array];
this.clear(); this.clear();
this.push.apply(this, new_array); this.push.apply(this, new_array);
@ -176,7 +176,7 @@
}, },
_resolveDaysOfWeek: function(daysOfWeek){ _resolveDaysOfWeek: function(daysOfWeek){
if (!$.isArray(daysOfWeek)) if (!Array.isArray(daysOfWeek))
daysOfWeek = daysOfWeek.split(/[,\s]*/); daysOfWeek = daysOfWeek.split(/[,\s]*/);
return $.map(daysOfWeek, Number); return $.map(daysOfWeek, Number);
}, },
@ -263,7 +263,7 @@
o.daysOfWeekHighlighted = this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]); o.daysOfWeekHighlighted = this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]);
o.datesDisabled = o.datesDisabled||[]; o.datesDisabled = o.datesDisabled||[];
if (!$.isArray(o.datesDisabled)) { if (!Array.isArray(o.datesDisabled)) {
o.datesDisabled = o.datesDisabled.split(','); o.datesDisabled = o.datesDisabled.split(',');
} }
o.datesDisabled = $.map(o.datesDisabled, function(d){ o.datesDisabled = $.map(o.datesDisabled, function(d){
@ -579,7 +579,7 @@
}, },
setDates: function(){ setDates: function(){
var args = $.isArray(arguments[0]) ? arguments[0] : arguments; var args = Array.isArray(arguments[0]) ? arguments[0] : arguments;
this.update.apply(this, args); this.update.apply(this, args);
this._trigger('changeDate'); this._trigger('changeDate');
this.setValue(); this.setValue();
@ -587,7 +587,7 @@
}, },
setUTCDates: function(){ setUTCDates: function(){
var args = $.isArray(arguments[0]) ? arguments[0] : arguments; var args = Array.isArray(arguments[0]) ? arguments[0] : arguments;
this.setDates.apply(this, $.map(args, this._utc_to_local)); this.setDates.apply(this, $.map(args, this._utc_to_local));
return this; return this;
}, },
@ -1039,7 +1039,7 @@
//Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2) //Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2)
//Fallback to unique function for older jquery versions //Fallback to unique function for older jquery versions
if ($.isFunction($.uniqueSort)) { if (typeof $.uniqueSort === "function") {
clsName = $.uniqueSort(clsName); clsName = $.uniqueSort(clsName);
} else { } else {
clsName = $.unique(clsName); clsName = $.unique(clsName);