From f3620c34a78b9c9fca80e21c2a96be0a61fd6dd1 Mon Sep 17 00:00:00 2001 From: bch36 <31776675+bch36@users.noreply.github.com> Date: Mon, 9 Apr 2018 14:54:08 -0700 Subject: [PATCH] Fixed inability to modify autoHide behavior after initialization Resizable: Previously, changing the autoHide option after initialization wouldn't change the behavior of the handles auto-hiding. This fix allows the resizable widget to accurately reflect the current autoHide state. Fixed #5408 - Resizable: autoHide option cannot be changed after initialization. https://bugs.jqueryui.com/ticket/5408 --- ui/widgets/resizable.js | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/ui/widgets/resizable.js b/ui/widgets/resizable.js index 36dd1251403..248c4be1b9c 100644 --- a/ui/widgets/resizable.js +++ b/ui/widgets/resizable.js @@ -161,25 +161,23 @@ $.widget( "ui.resizable", $.ui.mouse, { this._setupHandles(); - if ( o.autoHide ) { - $( this.element ) - .on( "mouseenter", function() { - if ( o.disabled ) { - return; - } - that._removeClass( "ui-resizable-autohide" ); - that._handles.show(); - } ) - .on( "mouseleave", function() { - if ( o.disabled ) { - return; - } - if ( !that.resizing ) { - that._addClass( "ui-resizable-autohide" ); - that._handles.hide(); - } - } ); - } + $( this.element ) + .on( "mouseenter", function() { + if ( o.disabled || !o.autoHide ) { + return; + } + that._removeClass( "ui-resizable-autohide" ); + that._handles.show(); + } ) + .on( "mouseleave", function() { + if ( o.disabled || !o.autoHide ) { + return; + } + if ( !that.resizing ) { + that._addClass( "ui-resizable-autohide" ); + that._handles.hide(); + } + } ); this._mouseInit(); },