jquery.ui: Use on() instead of deprecated bind() in jquery.ui.mouse
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 28 Apr 2018 00:16:03 +0000 (01:16 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Sat, 28 Apr 2018 00:18:18 +0000 (01:18 +0100)
Frequently seen on Beta Cluster due to indirect usage from
PageTriage extension.

Bug: T169385
Change-Id: Ia49ad6470aef1bcb1dd91c779dcd108a0a98d4dc

resources/lib/jquery.ui/PATCHES
resources/lib/jquery.ui/jquery.ui.mouse.js

index 321b8b9..0450ec8 100644 (file)
@@ -16,6 +16,11 @@ jquery.ui.datepicker
 * I717f2580e Avoid deprecated jQuery.expr.filters.
 
 
+jquery.ui.mouse.js
+* Ia49ad6470 Avoid deprecated jQuery.fn.bind().
+* Ia49ad6470 Avoid deprecated jQuery.fn.unbind().
+
+
 jquery.ui.widget.js
 * I7ffbfd2e5 Avoid deprecated jQuery.expr[":"].
 * I717f2580e Avoid deprecated jQuery.fn.bind().
index 250365f..83d8e53 100644 (file)
@@ -29,10 +29,10 @@ $.widget("ui.mouse", {
                var that = this;
 
                this.element
-                       .bind('mousedown.'+this.widgetName, function(event) {
+                       .on('mousedown.'+this.widgetName, function(event) {
                                return that._mouseDown(event);
                        })
-                       .bind('click.'+this.widgetName, function(event) {
+                       .on('click.'+this.widgetName, function(event) {
                                if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
                                        $.removeData(event.target, that.widgetName + '.preventClickEvent');
                                        event.stopImmediatePropagation();
@@ -46,11 +46,11 @@ $.widget("ui.mouse", {
        // TODO: make sure destroying one instance of mouse doesn't mess with
        // other instances of mouse
        _mouseDestroy: function() {
-               this.element.unbind('.'+this.widgetName);
+               this.element.off('.'+this.widgetName);
                if ( this._mouseMoveDelegate ) {
                        $(document)
-                               .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
-                               .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+                               .off('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+                               .off('mouseup.'+this.widgetName, this._mouseUpDelegate);
                }
        },
 
@@ -100,8 +100,8 @@ $.widget("ui.mouse", {
                        return that._mouseUp(event);
                };
                $(document)
-                       .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
-                       .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+                       .on('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+                       .on('mouseup.'+this.widgetName, this._mouseUpDelegate);
 
                event.preventDefault();
 
@@ -131,8 +131,8 @@ $.widget("ui.mouse", {
 
        _mouseUp: function(event) {
                $(document)
-                       .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
-                       .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+                       .off('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+                       .off('mouseup.'+this.widgetName, this._mouseUpDelegate);
 
                if (this._mouseStarted) {
                        this._mouseStarted = false;