Skip to content

Commit

Permalink
Merge branch 'hartvig/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianmandrup committed Aug 13, 2012
2 parents 1834c29 + 7b79040 commit 2fdcce2
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions msdropdown/js/uncompressed.jquery.dd.js
Expand Up @@ -57,7 +57,8 @@
var isClosing = false;
var cacheElement = {};
var inputText = "";

var selectedItem;

var getElement = function(ele) {
if(typeof(cacheElement[ele])=="undefined") {
cacheElement[ele] = document.getElementById(ele);
Expand All @@ -73,16 +74,19 @@
return (typeof styles=="undefined") ? "" : styles.cssText;
};
var matchIndex = function (index) {
var selectedIndex = $("#"+elementid+" option:selected");
if(selectedIndex.length>1) {
for(var i=0;i<selectedIndex.length;i++) {
if(index == selectedIndex[i].index) {
return true;
};
};
} else if(selectedIndex.length==1) {
if(selectedIndex[0].index==index) {
return true;
// For performance, store last selected item once in a local variable rather than looking it up
// everytime matchIndex is called
if (typeof this.selectedItem === 'undefined')
this.selectedItem = $("#" + elementid + " option:selected");
if (this.selectedItem.length > 1) {
for (var i = 0; i < this.selectedItem.length; i++) {
if (index == this.selectedItem[i].index) {
return true;
};
};
} else if (this.selectedItem.length == 1) {
if (this.selectedItem[0].index == index) {
return true;
};
};
return false;
Expand Down

0 comments on commit 2fdcce2

Please sign in to comment.