From 4dfeaabe9b63772dd72ec1a9d8058dcc07c8c0e2 Mon Sep 17 00:00:00 2001 From: Igor Suleymanov Date: Mon, 3 Aug 2015 16:30:18 +0300 Subject: [PATCH 1/2] Allow `onHide` callbacks for dropdown prevent hiding I found out that there is no way to prevent dropdown from being hidden in specific cases, so I thought this might be quite handy. In my scenario, I use an input field with attached `jquery-datepicker` and whenever I want to jump between month in it, the dropdown hides. Therefore I propose to add this small feature. --- src/definitions/modules/dropdown.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 49da61ddd..0980fca35 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -423,11 +423,14 @@ $.fn.dropdown = function(parameters) { ; if( module.is.active() ) { module.debug('Hiding dropdown'); - module.animate.hide(function() { - module.remove.visible(); - callback.call(element); - }); - settings.onHide.call(element); + var hideDropdown = settings.onHide.call(element); + + if (hideDropdown === false) { + module.animate.hide(function() { + module.remove.visible(); + callback.call(element); + }); + } } }, From bfb140850989ce144675dda5a2a2b918bc2aebe3 Mon Sep 17 00:00:00 2001 From: Igor Suleymanov Date: Mon, 3 Aug 2015 20:13:31 +0300 Subject: [PATCH 2/2] chore: Remove unnecessary variable --- src/definitions/modules/dropdown.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 0980fca35..71bcb06f6 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -423,9 +423,7 @@ $.fn.dropdown = function(parameters) { ; if( module.is.active() ) { module.debug('Hiding dropdown'); - var hideDropdown = settings.onHide.call(element); - - if (hideDropdown === false) { + if(settings.onHide.call(element) === false) { module.animate.hide(function() { module.remove.visible(); callback.call(element);