diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index 62c01935c..ad046c44a 100755 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -210,8 +210,12 @@ $.fn.dropdown = function(parameters) { click: function (event) { var $choice = $(this), - text = $choice.data(metadata.text) || $choice.text(), - value = $choice.data(metadata.value) || text.toLowerCase() + text = ( $choice.data(metadata.text) !== undefined ) + ? $choice.data(metadata.text) + : $choice.text(), + value = ( $choice.data(metadata.value) !== undefined) + ? $choice.data(metadata.value) + : text.toLowerCase() ; if( $choice.find(selector.menu).size() === 0 ) { module.determine.selectAction(text, value); @@ -322,15 +326,21 @@ $.fn.dropdown = function(parameters) { ; value = (value !== undefined) ? value - : ( module.get.value() || module.get.text() ) + : ( module.get.value() !== undefined) + ? module.get.value() + : module.get.text() ; if(value) { $item .each(function() { var $choice = $(this), - optionText = $choice.data(metadata.text) || $choice.text(), - optionValue = $choice.data(metadata.value) || optionText.toLowerCase() + optionText = ( $choice.data(metadata.text) !== undefined ) + ? $choice.data(metadata.text) + : $choice.text(), + optionValue = ( $choice.data(metadata.value) !== undefined ) + ? $choice.data(metadata.value) + : optionText.toLowerCase() ; if( optionValue == value || optionText == value ) { $selectedItem = $(this); @@ -369,7 +379,10 @@ $.fn.dropdown = function(parameters) { ; if($selectedItem) { module.debug('Setting selected menu item to', $selectedItem); - selectedText = $selectedItem.data(metadata.text) || $selectedItem.text(); + selectedText = ($selectedItem.data(metadata.text) !== undefined) + ? $selectedItem.data(metadata.text) + : $selectedItem.text() + ; $item .removeClass(className.active) ;