From 66ee66477c6b66f82b3d66ea168bce024f922ba9 Mon Sep 17 00:00:00 2001 From: jlukic Date: Wed, 27 May 2015 16:37:31 -0400 Subject: [PATCH] Speed up get.item when null or undefined --- src/definitions/modules/dropdown.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index d4d78cdca..16cbf0d7e 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -1516,7 +1516,7 @@ $.fn.dropdown = function(parameters) { ? true : strict || false ; - if(value !== undefined) { + if(value !== undefined && value !== null) { $item .each(function() { var @@ -1524,6 +1524,10 @@ $.fn.dropdown = function(parameters) { optionText = module.get.choiceText($choice), optionValue = module.get.choiceValue($choice, optionText) ; + // safe early exit + if(optionValue === null || optionValue === undefined) { + return; + } if(isMultiple) { if($.inArray(optionValue.toString(), value) !== -1 || $.inArray(optionText, value) !== -1) { $selectedItem = ($selectedItem)