Skip to content

Commit

Permalink
fix: Replace some deprecated jQuery with recommended replacements (#4607
Browse files Browse the repository at this point in the history
)
  • Loading branch information
larseggert authored Oct 19, 2022
1 parent cf03335 commit 76b88b1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ietf/static/js/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
replace: function(new_array){
if (!new_array)
return;
if (!$.isArray(new_array))
if (!Array.isArray(new_array))
new_array = [new_array];
this.clear();
this.push.apply(this, new_array);
Expand Down Expand Up @@ -176,7 +176,7 @@
},

_resolveDaysOfWeek: function(daysOfWeek){
if (!$.isArray(daysOfWeek))
if (!Array.isArray(daysOfWeek))
daysOfWeek = daysOfWeek.split(/[,\s]*/);
return $.map(daysOfWeek, Number);
},
Expand Down Expand Up @@ -263,7 +263,7 @@
o.daysOfWeekHighlighted = this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]);

o.datesDisabled = o.datesDisabled||[];
if (!$.isArray(o.datesDisabled)) {
if (!Array.isArray(o.datesDisabled)) {
o.datesDisabled = o.datesDisabled.split(',');
}
o.datesDisabled = $.map(o.datesDisabled, function(d){
Expand Down Expand Up @@ -579,15 +579,15 @@
},

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._trigger('changeDate');
this.setValue();
return this;
},

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));
return this;
},
Expand Down Expand Up @@ -1039,7 +1039,7 @@

//Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2)
//Fallback to unique function for older jquery versions
if ($.isFunction($.uniqueSort)) {
if (typeof $.uniqueSort === "function") {
clsName = $.uniqueSort(clsName);
} else {
clsName = $.unique(clsName);
Expand Down

0 comments on commit 76b88b1

Please sign in to comment.