Browse Source

Speed up get.item when null or undefined

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

6
src/definitions/modules/dropdown.js

@ -1516,7 +1516,7 @@ $.fn.dropdown = function(parameters) {
? true ? true
: strict || false : strict || false
; ;
if(value !== undefined) {
if(value !== undefined && value !== null) {
$item $item
.each(function() { .each(function() {
var var
@ -1524,6 +1524,10 @@ $.fn.dropdown = function(parameters) {
optionText = module.get.choiceText($choice), optionText = module.get.choiceText($choice),
optionValue = module.get.choiceValue($choice, optionText) optionValue = module.get.choiceValue($choice, optionText)
; ;
// safe early exit
if(optionValue === null || optionValue === undefined) {
return;
}
if(isMultiple) { if(isMultiple) {
if($.inArray(optionValue.toString(), value) !== -1 || $.inArray(optionText, value) !== -1) { if($.inArray(optionValue.toString(), value) !== -1 || $.inArray(optionText, value) !== -1) {
$selectedItem = ($selectedItem) $selectedItem = ($selectedItem)

Loading…
Cancel
Save