Browse Source

Fixes #1916, onChange fires even when selected value is current value

pull/1785/merge
jlukic 9 years ago
parent
commit
6c3b253ebb
1 changed files with 5 additions and 1 deletions
  1. 6
      src/definitions/modules/dropdown.js

6
src/definitions/modules/dropdown.js

@ -965,19 +965,23 @@ $.fn.dropdown = function(parameters) {
module.verbose('Ambiguous dropdown value using strict type check', $choice, value); module.verbose('Ambiguous dropdown value using strict type check', $choice, value);
if( optionValue === value ) { if( optionValue === value ) {
$selectedItem = $(this); $selectedItem = $(this);
return true;
} }
else if( !$selectedItem && optionText === value ) { else if( !$selectedItem && optionText === value ) {
$selectedItem = $(this); $selectedItem = $(this);
return true;
} }
} }
else { else {
if( optionValue == value ) { if( optionValue == value ) {
module.verbose('Found select item by value', optionValue, value); module.verbose('Found select item by value', optionValue, value);
$selectedItem = $(this); $selectedItem = $(this);
return true;
} }
else if( !$selectedItem && optionText == value ) { else if( !$selectedItem && optionText == value ) {
module.verbose('Found select item by text', optionText, value); module.verbose('Found select item by text', optionText, value);
$selectedItem = $(this); $selectedItem = $(this);
return true;
} }
} }
}) })
@ -1180,7 +1184,7 @@ $.fn.dropdown = function(parameters) {
selectedText, selectedText,
selectedValue selectedValue
; ;
if($selectedItem) {
if($selectedItem && !$selectedItem.hasClass(className.active) ) {
module.debug('Setting selected menu item to', $selectedItem); module.debug('Setting selected menu item to', $selectedItem);
module.remove.activeItem(); module.remove.activeItem();
module.remove.selectedItem(); module.remove.selectedItem();

Loading…
Cancel
Save