Browse Source

Deal with type casting in a consistent way

pull/2907/head
jlukic 9 years ago
parent
commit
c43ea73f7f
2 changed files with 10 additions and 8 deletions
  1. 1
      RELEASE-NOTES.md
  2. 17
      src/definitions/modules/dropdown.js

1
RELEASE-NOTES.md

@ -88,6 +88,7 @@
- **Build Tools** - Fixes issue on `win` platform where packaged theme would not correctly update when using watch due to regExp not matching windows path separators.
- **Dropdown** - Dropdown will no longer fire native `onchange` event on hidden input when setting value during initial load (unless `fireOnInit: true`) #2795 **Thanks @lauri-elevant**
- **Dropdown** - Fixed issue where `forceSelection` would not occur when `pageLostFocus` (clicked into another tab and back)
- **Dropdown** - Fixed issue where using the specific value `value="false"` would cause an option to not be removable from a multiple select
- **Dropdown/Tab** - Fixed an instance where `metadata` was not referencing settings metadata value
- **Form Validation** - Fixed issue with `get value(s)` where unchecked checkboxes would not correctly retrieve values
- **Input** `action input` and `labeled input` now have focused border on inner edge with label/button

17
src/definitions/modules/dropdown.js

@ -1562,10 +1562,10 @@ $.fn.dropdown = function(parameters) {
return false;
}
return ($choice.data(metadata.value) !== undefined)
? $choice.data(metadata.value)
? String( $choice.data(metadata.value) )
: (typeof choiceText === 'string')
? $.trim(choiceText.toLowerCase())
: choiceText
: String(choiceText)
;
},
inputEvent: function() {
@ -1688,7 +1688,7 @@ $.fn.dropdown = function(parameters) {
return;
}
if(isMultiple) {
if($.inArray(optionValue.toString(), value) !== -1 || $.inArray(optionText, value) !== -1) {
if($.inArray( String(optionValue), value) !== -1 || $.inArray(optionText, value) !== -1) {
$selectedItem = ($selectedItem)
? $selectedItem.add($choice)
: $choice
@ -1703,7 +1703,7 @@ $.fn.dropdown = function(parameters) {
}
}
else {
if( optionValue.toString() == value.toString() || optionText == value) {
if( String(optionValue) == String(value) || optionText == value) {
module.verbose('Found select item by value', optionValue, value);
$selectedItem = $choice;
return true;
@ -2143,8 +2143,8 @@ $.fn.dropdown = function(parameters) {
hasInput = ($input.length > 0),
isAddition = !module.has.value(value),
currentValue = module.get.values(),
stringValue = (typeof value == 'number')
? value.toString()
stringValue = (value !== undefined)
? String(value)
: value,
newValue
;
@ -2544,6 +2544,7 @@ $.fn.dropdown = function(parameters) {
;
if(module.is.multiple()) {
if(settings.useLabels) {
console.log(selectedValue);
module.remove.value(selectedValue, selectedText, $selected);
module.remove.label(selectedValue);
}
@ -2622,8 +2623,8 @@ $.fn.dropdown = function(parameters) {
.each(function(){
var
value = $(this).data(metadata.value),
stringValue = (typeof value == 'number')
? value.toString()
stringValue = (value !== undefined)
? String(value)
: value,
isUserValue = module.is.userValue(stringValue)
;

Loading…
Cancel
Save