From a0e22fb474640e3070b5911c5accc0d7821f9333 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 28 Apr 2018 01:16:03 +0100 Subject: [PATCH] jquery.ui: Use on() instead of deprecated bind() in jquery.ui.mouse Frequently seen on Beta Cluster due to indirect usage from PageTriage extension. Bug: T169385 Change-Id: Ia49ad6470aef1bcb1dd91c779dcd108a0a98d4dc --- resources/lib/jquery.ui/PATCHES | 5 +++++ resources/lib/jquery.ui/jquery.ui.mouse.js | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/resources/lib/jquery.ui/PATCHES b/resources/lib/jquery.ui/PATCHES index 321b8b9eb0..0450ec81a2 100644 --- a/resources/lib/jquery.ui/PATCHES +++ b/resources/lib/jquery.ui/PATCHES @@ -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(). diff --git a/resources/lib/jquery.ui/jquery.ui.mouse.js b/resources/lib/jquery.ui/jquery.ui.mouse.js index 250365fe72..83d8e5308b 100644 --- a/resources/lib/jquery.ui/jquery.ui.mouse.js +++ b/resources/lib/jquery.ui/jquery.ui.mouse.js @@ -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; -- 2.20.1