aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Sarabadani <Ladsgroup@gmail.com>2021-07-08 00:19:38 +0200
committerAmir Sarabadani <Ladsgroup@gmail.com>2021-07-10 00:32:16 +0200
commit9a53734df203d513695eba1602c9147d5f14049a (patch)
tree598025005f38c58fb8228145f1bcc1237b263ec3
parentcf8ec9bcae14f9127fe6e7989b0ced7a5b01949f (diff)
downloadmediawikicore-9a53734df203d513695eba1602c9147d5f14049a.tar.gz
mediawikicore-9a53734df203d513695eba1602c9147d5f14049a.zip
Patch jquery.ui to reduce deprecation warnings
Found them mostly by checking Wikibase repo. There are many more left. Bug: T280944 Change-Id: Icb54f847d32739674d74ab6cc5d55e9cbf738908
-rw-r--r--resources/lib/jquery.ui/PATCHES3
-rw-r--r--resources/lib/jquery.ui/jquery.ui.autocomplete.js2
-rw-r--r--resources/lib/jquery.ui/jquery.ui.button.js2
-rw-r--r--resources/lib/jquery.ui/jquery.ui.datepicker.js6
-rw-r--r--resources/lib/jquery.ui/jquery.ui.dialog.js2
-rw-r--r--resources/lib/jquery.ui/jquery.ui.draggable.js6
-rw-r--r--resources/lib/jquery.ui/jquery.ui.droppable.js4
-rw-r--r--resources/lib/jquery.ui/jquery.ui.effect.js10
-rw-r--r--resources/lib/jquery.ui/jquery.ui.position.js7
-rw-r--r--resources/lib/jquery.ui/jquery.ui.resizable.js2
-rw-r--r--resources/lib/jquery.ui/jquery.ui.slider.js4
-rw-r--r--resources/lib/jquery.ui/jquery.ui.sortable.js12
-rw-r--r--resources/lib/jquery.ui/jquery.ui.tabs.js14
-rw-r--r--resources/lib/jquery.ui/jquery.ui.tooltip.js4
-rw-r--r--resources/lib/jquery.ui/jquery.ui.widget.js6
15 files changed, 45 insertions, 39 deletions
diff --git a/resources/lib/jquery.ui/PATCHES b/resources/lib/jquery.ui/PATCHES
index 0450ec81a24b..543f85908a75 100644
--- a/resources/lib/jquery.ui/PATCHES
+++ b/resources/lib/jquery.ui/PATCHES
@@ -1,3 +1,6 @@
+General:
+* Icb54f847 Fixing multiple jQuery deprecations.
+
jquery.ui.core.js
* I7ffbfd2e5 Avoid deprecated jQuery.expr[":"].
* I717f2580e Avoid deprecated jQuery.expr.filters.
diff --git a/resources/lib/jquery.ui/jquery.ui.autocomplete.js b/resources/lib/jquery.ui/jquery.ui.autocomplete.js
index 3baed1daf084..12883c60fb46 100644
--- a/resources/lib/jquery.ui/jquery.ui.autocomplete.js
+++ b/resources/lib/jquery.ui/jquery.ui.autocomplete.js
@@ -345,7 +345,7 @@ $.widget( "ui.autocomplete", {
_initSource: function() {
var array, url,
that = this;
- if ( $.isArray(this.options.source) ) {
+ if ( Array.isArray(this.options.source) ) {
array = this.options.source;
this.source = function( request, response ) {
response( $.ui.autocomplete.filter( array, request.term ) );
diff --git a/resources/lib/jquery.ui/jquery.ui.button.js b/resources/lib/jquery.ui/jquery.ui.button.js
index 53cf69922f8f..26d00081098f 100644
--- a/resources/lib/jquery.ui/jquery.ui.button.js
+++ b/resources/lib/jquery.ui/jquery.ui.button.js
@@ -348,7 +348,7 @@ $.widget( "ui.button", {
buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
if ( !this.hasTitle ) {
- buttonElement.attr( "title", $.trim( buttonText ) );
+ buttonElement.attr( "title", buttonText.trim() );
}
}
} else {
diff --git a/resources/lib/jquery.ui/jquery.ui.datepicker.js b/resources/lib/jquery.ui/jquery.ui.datepicker.js
index 15982fde5140..6c16ae6c2ae7 100644
--- a/resources/lib/jquery.ui/jquery.ui.datepicker.js
+++ b/resources/lib/jquery.ui/jquery.ui.datepicker.js
@@ -1772,17 +1772,17 @@ $.extend(Datepicker.prototype, {
/*
* Bind hover events for datepicker elements.
- * Done via delegate so the binding only occurs once in the lifetime of the parent div.
+ * Done via .on() so the binding only occurs once in the lifetime of the parent div.
* Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
*/
function bindHover(dpDiv) {
var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
- return dpDiv.delegate(selector, 'mouseout', function() {
+ return dpDiv.on('mouseout', selector, function() {
$(this).removeClass('ui-state-hover');
if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
})
- .delegate(selector, 'mouseover', function(){
+ .on('mouseover', selector, function(){
if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
$(this).addClass('ui-state-hover');
diff --git a/resources/lib/jquery.ui/jquery.ui.dialog.js b/resources/lib/jquery.ui/jquery.ui.dialog.js
index 75a9e8f902ec..55f3abeb6fbe 100644
--- a/resources/lib/jquery.ui/jquery.ui.dialog.js
+++ b/resources/lib/jquery.ui/jquery.ui.dialog.js
@@ -370,7 +370,7 @@ $.widget("ui.dialog", {
if ( hasButtons ) {
$.each( buttons, function( name, props ) {
var button, click;
- props = $.isFunction( props ) ?
+ props = typeof props === 'function' ?
{ click: props, text: name } :
props;
// Default to a non-submitting button
diff --git a/resources/lib/jquery.ui/jquery.ui.draggable.js b/resources/lib/jquery.ui/jquery.ui.draggable.js
index 723dbd4915ce..6f14c9ab3e8b 100644
--- a/resources/lib/jquery.ui/jquery.ui.draggable.js
+++ b/resources/lib/jquery.ui/jquery.ui.draggable.js
@@ -216,7 +216,7 @@ $.widget("ui.draggable", $.ui.mouse, {
if ( !elementInDom && this.options.helper === "original" )
return false;
- if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
+ if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || (typeof this.options.revert === 'function' && this.options.revert.call(this.element, dropped))) {
var that = this;
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
if(that._trigger("stop", event) !== false) {
@@ -273,7 +273,7 @@ $.widget("ui.draggable", $.ui.mouse, {
_createHelper: function(event) {
var o = this.options;
- var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
+ var helper = typeof o.helper === 'function' ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
if(!helper.parents('body').length)
helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
@@ -289,7 +289,7 @@ $.widget("ui.draggable", $.ui.mouse, {
if (typeof obj == 'string') {
obj = obj.split(' ');
}
- if ($.isArray(obj)) {
+ if (Array.isArray(obj)) {
obj = {left: +obj[0], top: +obj[1] || 0};
}
if ('left' in obj) {
diff --git a/resources/lib/jquery.ui/jquery.ui.droppable.js b/resources/lib/jquery.ui/jquery.ui.droppable.js
index 1e9ea5139bb2..d3f7f4007839 100644
--- a/resources/lib/jquery.ui/jquery.ui.droppable.js
+++ b/resources/lib/jquery.ui/jquery.ui.droppable.js
@@ -33,7 +33,7 @@ $.widget("ui.droppable", {
var o = this.options, accept = o.accept;
this.isover = 0; this.isout = 1;
- this.accept = $.isFunction(accept) ? accept : function(d) {
+ this.accept = typeof accept === 'function' ? accept : function(d) {
return d.is(accept);
};
@@ -60,7 +60,7 @@ $.widget("ui.droppable", {
_setOption: function(key, value) {
if(key == 'accept') {
- this.accept = $.isFunction(value) ? value : function(d) {
+ this.accept = typeof value === 'function' ? value : function(d) {
return d.is(value);
};
}
diff --git a/resources/lib/jquery.ui/jquery.ui.effect.js b/resources/lib/jquery.ui/jquery.ui.effect.js
index c8e5818bb033..14adbe91323a 100644
--- a/resources/lib/jquery.ui/jquery.ui.effect.js
+++ b/resources/lib/jquery.ui/jquery.ui.effect.js
@@ -1057,7 +1057,7 @@ function _normalizeArguments( effect, options, speed, callback ) {
}
// catch (effect, callback)
- if ( $.isFunction( options ) ) {
+ if ( typeof options === 'function' ) {
callback = options;
speed = null;
options = {};
@@ -1071,7 +1071,7 @@ function _normalizeArguments( effect, options, speed, callback ) {
}
// catch (effect, options, callback)
- if ( $.isFunction( speed ) ) {
+ if ( typeof speed === 'function' ) {
callback = speed;
speed = null;
}
@@ -1139,10 +1139,10 @@ $.fn.extend({
mode = args.mode;
function done() {
- if ( $.isFunction( complete ) ) {
+ if ( typeof complete === 'function' ) {
complete.call( elem[0] );
}
- if ( $.isFunction( next ) ) {
+ if ( typeof next === 'function' ) {
next();
}
}
@@ -1195,7 +1195,7 @@ $.fn.extend({
// jQuery core overloads toggle and creates _toggle
__toggle: $.fn.toggle,
toggle: function( speed ) {
- if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
+ if ( standardSpeed( speed ) || typeof speed === "boolean" || typeof speed === 'function' ) {
return this.__toggle.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
diff --git a/resources/lib/jquery.ui/jquery.ui.position.js b/resources/lib/jquery.ui/jquery.ui.position.js
index be99013ef6c6..8023ae11aa23 100644
--- a/resources/lib/jquery.ui/jquery.ui.position.js
+++ b/resources/lib/jquery.ui/jquery.ui.position.js
@@ -68,9 +68,12 @@ $.position = {
height: hasOverflowY ? $.position.scrollbarWidth() : 0
};
},
+ isWindow: function( obj ) {
+ return obj != null && obj === obj.window;
+ },
getWithinInfo: function( element ) {
var withinElement = $( element || window ),
- isWindow = $.isWindow( withinElement[0] );
+ isWindow = this.isWindow( withinElement[0] );
return {
element: withinElement,
isWindow: isWindow,
@@ -103,7 +106,7 @@ $.fn.position = function( options ) {
targetWidth = target.width();
targetHeight = target.height();
targetOffset = { top: 0, left: 0 };
- } else if ( $.isWindow( targetElem ) ) {
+ } else if ( $.position.isWindow( targetElem ) ) {
targetWidth = target.width();
targetHeight = target.height();
targetOffset = { top: target.scrollTop(), left: target.scrollLeft() };
diff --git a/resources/lib/jquery.ui/jquery.ui.resizable.js b/resources/lib/jquery.ui/jquery.ui.resizable.js
index bb277e237032..260a65ac2ae4 100644
--- a/resources/lib/jquery.ui/jquery.ui.resizable.js
+++ b/resources/lib/jquery.ui/jquery.ui.resizable.js
@@ -97,7 +97,7 @@ $.widget("ui.resizable", $.ui.mouse, {
for(var i = 0; i < n.length; i++) {
- var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
+ var handle = n[i].trim(), hname = 'ui-resizable-'+handle;
var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
// Apply zIndex to all handles - see #7960
diff --git a/resources/lib/jquery.ui/jquery.ui.slider.js b/resources/lib/jquery.ui/jquery.ui.slider.js
index c3daa7a409c5..0108e7056fe6 100644
--- a/resources/lib/jquery.ui/jquery.ui.slider.js
+++ b/resources/lib/jquery.ui/jquery.ui.slider.js
@@ -447,7 +447,7 @@ $.widget( "ui.slider", $.ui.mouse, {
}
if ( arguments.length ) {
- if ( $.isArray( arguments[ 0 ] ) ) {
+ if ( Array.isArray( arguments[ 0 ] ) ) {
vals = this.options.values;
newValues = arguments[ 0 ];
for ( i = 0; i < vals.length; i += 1 ) {
@@ -471,7 +471,7 @@ $.widget( "ui.slider", $.ui.mouse, {
var i,
valsLength = 0;
- if ( $.isArray( this.options.values ) ) {
+ if ( Array.isArray( this.options.values ) ) {
valsLength = this.options.values.length;
}
diff --git a/resources/lib/jquery.ui/jquery.ui.sortable.js b/resources/lib/jquery.ui/jquery.ui.sortable.js
index bd960df3eaf9..ff16b7df7607 100644
--- a/resources/lib/jquery.ui/jquery.ui.sortable.js
+++ b/resources/lib/jquery.ui/jquery.ui.sortable.js
@@ -540,13 +540,13 @@ $.widget("ui.sortable", $.ui.mouse, {
for (var j = cur.length - 1; j >= 0; j--){
var inst = $.data(cur[j], this.widgetName);
if(inst && inst != this && !inst.options.disabled) {
- queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
+ queries.push([typeof inst.options.items === 'function' ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
}
};
};
}
- queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
+ queries.push([typeof this.options.items === 'function' ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
for (var i = queries.length - 1; i >= 0; i--){
queries[i][0].each(function() {
@@ -577,7 +577,7 @@ $.widget("ui.sortable", $.ui.mouse, {
this.items = [];
this.containers = [this];
var items = this.items;
- var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
+ var queries = [[typeof this.options.items === 'function' ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
var connectWith = this._connectWith();
if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
@@ -586,7 +586,7 @@ $.widget("ui.sortable", $.ui.mouse, {
for (var j = cur.length - 1; j >= 0; j--){
var inst = $.data(cur[j], this.widgetName);
if(inst && inst != this && !inst.options.disabled) {
- queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
+ queries.push([typeof inst.options.items === 'function' ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
this.containers.push(inst);
}
};
@@ -778,7 +778,7 @@ $.widget("ui.sortable", $.ui.mouse, {
_createHelper: function(event) {
var o = this.options;
- var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
+ var helper = typeof o.helper === 'function' ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
$(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
@@ -797,7 +797,7 @@ $.widget("ui.sortable", $.ui.mouse, {
if (typeof obj == 'string') {
obj = obj.split(' ');
}
- if ($.isArray(obj)) {
+ if (Array.isArray(obj)) {
obj = {left: +obj[0], top: +obj[1] || 0};
}
if ('left' in obj) {
diff --git a/resources/lib/jquery.ui/jquery.ui.tabs.js b/resources/lib/jquery.ui/jquery.ui.tabs.js
index 6ea164eb780c..10ae17b01cb8 100644
--- a/resources/lib/jquery.ui/jquery.ui.tabs.js
+++ b/resources/lib/jquery.ui/jquery.ui.tabs.js
@@ -118,7 +118,7 @@ $.widget( "ui.tabs", {
// Take disabling tabs via class attribute from HTML
// into account and update option properly.
- if ( $.isArray( options.disabled ) ) {
+ if ( Array.isArray( options.disabled ) ) {
options.disabled = $.unique( options.disabled.concat(
$.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
return that.tabs.index( li );
@@ -446,7 +446,7 @@ $.widget( "ui.tabs", {
},
_setupDisabled: function( disabled ) {
- if ( $.isArray( disabled ) ) {
+ if ( Array.isArray( disabled ) ) {
if ( !disabled.length ) {
disabled = false;
} else if ( disabled.length === this.anchors.length ) {
@@ -744,7 +744,7 @@ $.widget( "ui.tabs", {
disabled = false;
} else {
index = this._getIndex( index );
- if ( $.isArray( disabled ) ) {
+ if ( Array.isArray( disabled ) ) {
disabled = $.map( disabled, function( num ) {
return num !== index ? num : null;
});
@@ -770,7 +770,7 @@ $.widget( "ui.tabs", {
if ( $.inArray( index, disabled ) !== -1 ) {
return;
}
- if ( $.isArray( disabled ) ) {
+ if ( Array.isArray( disabled ) ) {
disabled = $.merge( [ index ], disabled ).sort();
} else {
disabled = [ index ];
@@ -980,7 +980,7 @@ if ( $.uiBackCompat !== false ) {
trigger;
if ( index && options.disabled === true ||
- ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) {
+ ( Array.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) {
trigger = true;
}
@@ -996,7 +996,7 @@ if ( $.uiBackCompat !== false ) {
trigger;
if ( index && options.disabled === false ||
- ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) {
+ ( Array.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) {
trigger = true;
}
@@ -1306,7 +1306,7 @@ if ( $.uiBackCompat !== false ) {
fx = this.options.fx;
if ( fx ) {
- if ( $.isArray( fx ) ) {
+ if ( Array.isArray( fx ) ) {
hide = fx[ 0 ];
show = fx[ 1 ];
} else {
diff --git a/resources/lib/jquery.ui/jquery.ui.tooltip.js b/resources/lib/jquery.ui/jquery.ui.tooltip.js
index 2b50b443e33e..782f8ff5a2f2 100644
--- a/resources/lib/jquery.ui/jquery.ui.tooltip.js
+++ b/resources/lib/jquery.ui/jquery.ui.tooltip.js
@@ -22,7 +22,7 @@ function addDescribedBy( elem, id ) {
describedby.push( id );
elem
.data( "ui-tooltip-id", id )
- .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
+ .attr( "aria-describedby", describedby.join( " " ).trim() );
}
function removeDescribedBy( elem ) {
@@ -34,7 +34,7 @@ function removeDescribedBy( elem ) {
}
elem.removeData( "ui-tooltip-id" );
- describedby = $.trim( describedby.join( " " ) );
+ describedby = describedby.join( " " ).trim();
if ( describedby ) {
elem.attr( "aria-describedby", describedby );
} else {
diff --git a/resources/lib/jquery.ui/jquery.ui.widget.js b/resources/lib/jquery.ui/jquery.ui.widget.js
index 9836fc99f2d1..f9f0387c2398 100644
--- a/resources/lib/jquery.ui/jquery.ui.widget.js
+++ b/resources/lib/jquery.ui/jquery.ui.widget.js
@@ -71,7 +71,7 @@ $.widget = function( name, base, prototype ) {
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
- if ( $.isFunction( value ) ) {
+ if ( typeof value === "function" ) {
prototype[ prop ] = (function() {
var _super = function() {
return base.prototype[ prop ].apply( this, arguments );
@@ -179,7 +179,7 @@ $.widget.bridge = function( name, object ) {
return $.error( "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'" );
}
- if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
+ if ( typeof instance[options] !== "function" || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
@@ -476,7 +476,7 @@ $.Widget.prototype = {
}
this.element.trigger( event, data );
- return !( $.isFunction( callback ) &&
+ return !( typeof callback === 'function' &&
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
}