Browse Source

Fixes #694 A dropdown with numeric content for data-text causes an error on toLowerCase

pull/701/merge
jlukic 10 years ago
parent
commit
94fb519bea
1 changed files with 6 additions and 2 deletions
  1. 8
      src/modules/dropdown.js

8
src/modules/dropdown.js

@ -216,7 +216,9 @@ $.fn.dropdown = function(parameters) {
: $choice.text(), : $choice.text(),
value = ( $choice.data(metadata.value) !== undefined) value = ( $choice.data(metadata.value) !== undefined)
? $choice.data(metadata.value) ? $choice.data(metadata.value)
: text.toLowerCase(),
: (typeof text === 'string')
? text.toLowerCase()
: text,
callback = function() { callback = function() {
module.determine.selectAction(text, value); module.determine.selectAction(text, value);
$.proxy(settings.onChange, element)(value, text); $.proxy(settings.onChange, element)(value, text);
@ -352,7 +354,9 @@ $.fn.dropdown = function(parameters) {
: $choice.text(), : $choice.text(),
optionValue = ( $choice.data(metadata.value) !== undefined ) optionValue = ( $choice.data(metadata.value) !== undefined )
? $choice.data(metadata.value) ? $choice.data(metadata.value)
: optionText.toLowerCase()
: (typeof optionText === 'string')
? optionText.toLowerCase()
: optionText
; ;
if( optionValue == value ) { if( optionValue == value ) {
$selectedItem = $(this); $selectedItem = $(this);

Loading…
Cancel
Save