Skip to content

Commit

Permalink
Fix: Deprecated jQuery.isArray()
Browse files Browse the repository at this point in the history
  • Loading branch information
Dernerd committed Dec 24, 2023
1 parent 32c3698 commit 4b208dd
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
6 changes: 3 additions & 3 deletions includes/psource-metaboxes/ui/select2/select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ the specific language governing permissions and limitations under the Apache Lic
return function (query) {
var t = query.term, filtered = {results: []};
var result = isFunc ? data(query) : data;
if ($.isArray(result)) {
if (Array.isArray(result)) {
$(result).each(function () {
var isObject = this.text !== undefined,
text = isObject ? this.text : this;
Expand Down Expand Up @@ -985,7 +985,7 @@ the specific language governing permissions and limitations under the Apache Lic
opts.id = function (e) { return e[idKey]; };
}

if ($.isArray(opts.element.data("select2Tags"))) {
if (Array.isArray(opts.element.data("select2Tags"))) {
if ("tags" in opts) {
throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id");
}
Expand Down Expand Up @@ -1707,7 +1707,7 @@ the specific language governing permissions and limitations under the Apache Lic
var maxSelSize = this.getMaximumSelectionSize();
if (maxSelSize >=1) {
data = this.data();
if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
if (Array.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
render("<li class='select2-selection-limit'>" + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + "</li>");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/psource-metaboxes/ui/select2/select2.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Halte Dich mit unserem [Newsletter](https://n3rds.work/webmasterservice-n3rdswor
* Fix: Deprecated .blur()
* Fix: Deprecated .bind()
* Fix: Deprecated jQuery.isFunction()
* Fix: Deprecated jQuery.isArray()

= 3.5.6 =

Expand Down
24 changes: 12 additions & 12 deletions ui/colorpicker/js/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ jQuery.extend = jQuery.fn.extend = function() {

// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
( copyIsArray = jQuery.isArray( copy ) ) ) ) {
( copyIsArray = Array.isArray( copy ) ) ) ) {

if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray( src ) ? src : [];
clone = src && Array.isArray( src ) ? src : [];

} else {
clone = src && jQuery.isPlainObject( src ) ? src : {};
Expand Down Expand Up @@ -278,7 +278,7 @@ jQuery.extend( {
// subtraction forces infinities to NaN
// adding 1 corrects loss of precision from parseFloat (#15100)
var realStringObj = obj && obj.toString();
return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
return !Array.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
},

isEmptyObject: function( obj ) {
Expand Down Expand Up @@ -3942,7 +3942,7 @@ function internalRemoveData( elem, name, pvt ) {
if ( thisCache ) {

// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
if ( !Array.isArray( name ) ) {

// try the string as a key before any manipulation
if ( name in thisCache ) {
Expand Down Expand Up @@ -4116,7 +4116,7 @@ jQuery.extend( {

// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray( data ) ) {
if ( !queue || Array.isArray( data ) ) {
queue = jQuery._data( elem, type, jQuery.makeArray( data ) );
} else {
queue.push( data );
Expand Down Expand Up @@ -7332,7 +7332,7 @@ jQuery.fn.extend( {
map = {},
i = 0;

if ( jQuery.isArray( name ) ) {
if ( Array.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;

Expand Down Expand Up @@ -7689,7 +7689,7 @@ function propFilter( props, specialEasing ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
if ( Array.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
Expand Down Expand Up @@ -8240,7 +8240,7 @@ jQuery.fn.extend( {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
} else if ( Array.isArray( val ) ) {
val = jQuery.map( val, function( value ) {
return value == null ? "" : value + "";
} );
Expand Down Expand Up @@ -8357,7 +8357,7 @@ jQuery.extend( {
jQuery.each( [ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
if ( Array.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
}
}
Expand Down Expand Up @@ -10026,7 +10026,7 @@ var r20 = /%20/g,
function buildParams( prefix, obj, traditional, add ) {
var name;

if ( jQuery.isArray( obj ) ) {
if ( Array.isArray( obj ) ) {

// Serialize array item.
jQuery.each( obj, function( i, v ) {
Expand Down Expand Up @@ -10079,7 +10079,7 @@ jQuery.param = function( a, traditional ) {
}

// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {

// Serialize the form elements
jQuery.each( a, function() {
Expand Down Expand Up @@ -10123,7 +10123,7 @@ jQuery.fn.extend( {

return val == null ?
null :
jQuery.isArray( val ) ?
Array.isArray( val ) ?
jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} ) :
Expand Down
2 changes: 1 addition & 1 deletion ui/js/jquery.validate.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ui/select2/select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ the specific language governing permissions and limitations under the Apache Lic
return function (query) {
var t = query.term, filtered = {results: []};
var result = isFunc ? data(query) : data;
if ($.isArray(result)) {
if (Array.isArray(result)) {
$(result).each(function () {
var isObject = this.text !== undefined,
text = isObject ? this.text : this;
Expand Down Expand Up @@ -985,7 +985,7 @@ the specific language governing permissions and limitations under the Apache Lic
opts.id = function (e) { return e[idKey]; };
}

if ($.isArray(opts.element.data("select2Tags"))) {
if (Array.isArray(opts.element.data("select2Tags"))) {
if ("tags" in opts) {
throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id");
}
Expand Down Expand Up @@ -1707,7 +1707,7 @@ the specific language governing permissions and limitations under the Apache Lic
var maxSelSize = this.getMaximumSelectionSize();
if (maxSelSize >=1) {
data = this.data();
if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
if (Array.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
render("<li class='select2-selection-limit'>" + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + "</li>");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/select2/select2.min.js

Large diffs are not rendered by default.

0 comments on commit 4b208dd

Please sign in to comment.