From 6c3b253ebb84e28e2ccdae91c5964543fbb87c64 Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 9 Mar 2015 11:37:02 -0400 Subject: [PATCH] Fixes #1916, onChange fires even when selected value is current value --- src/definitions/modules/dropdown.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 9c8433666..af56d1c58 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -965,19 +965,23 @@ $.fn.dropdown = function(parameters) { module.verbose('Ambiguous dropdown value using strict type check', $choice, value); if( optionValue === value ) { $selectedItem = $(this); + return true; } else if( !$selectedItem && optionText === value ) { $selectedItem = $(this); + return true; } } else { if( optionValue == value ) { module.verbose('Found select item by value', optionValue, value); $selectedItem = $(this); + return true; } else if( !$selectedItem && optionText == value ) { module.verbose('Found select item by text', optionText, value); $selectedItem = $(this); + return true; } } }) @@ -1180,7 +1184,7 @@ $.fn.dropdown = function(parameters) { selectedText, selectedValue ; - if($selectedItem) { + if($selectedItem && !$selectedItem.hasClass(className.active) ) { module.debug('Setting selected menu item to', $selectedItem); module.remove.activeItem(); module.remove.selectedItem();