fed0c4808d2d94b214d6c423c6afb3a709955432
tdreszer
  Wed Jun 29 16:41:15 2011 -0700
IE is so damn slow.  I had to limit the attempt by IE to gray invalid options in filterComposite boxes.
diff --git src/hg/js/hui.js src/hg/js/hui.js
index b5dc46b..2d449b8 100644
--- src/hg/js/hui.js
+++ src/hg/js/hui.js
@@ -915,42 +915,63 @@
             var selectedTags = $( this ).val();
             if( !selectedTags || selectedTags.length == 0)
                 oneEmpty = true;
             else if( selectedTags && selectedTags.length > 0 && selectedTags[0] != "All" ) {
                 subCBs = objsFilterByClasses(subCBs,"or",selectedTags);  // must belong to one or more
                 allSelectedTags = allSelectedTags.concat(selectedTags);
             }
         }
     });
     // Matrix CBs need to be considered too
     if (subCBs.length > 0) {
         var matCb = $("input.matCB").filter(":checked");
         if (matCb.length == 0)
             oneEmpty = true;
         else {//if (matCb.length > 0) {
+            // If all selected, no additional filtering needed.
+            if (matCb.length < $("input.matCB").length) {
             var matchClasses = "";
             $( matCb ).each( function(i) {
                 var filterClasses = $( this ).attr("class").split(" ");
                 filterClasses = aryRemove(filterClasses,"matCB","halfVis","abc");
                 matchClasses = matchClasses + ",." + filterClasses.join('.');
             });
             if (matchClasses.length > 0) {
                 matchClasses = matchClasses.substring(1); // Skip past leading comma: ",.HepG2.ZBTB33,.GM12878.CTCF"
+                    if ($.browser.msie) {   // IE was hanging on .filter(matchClasses), so do this ourselves
+                        var matchSets = matchClasses.split(',');
+                        if (matchSets < 80 && $(subCBs).length < 300) { // IE is just choking!
+                            var subsAccumulating = null;
+                            while(matchSets.length > 0) {
+                                var matchThis = matchSets.pop();
+                                var subBatch = $(subCBs).filter(matchThis);
+                                if (subBatch != undefined && subBatch.length > 0) {
+                                    //subCBs = $(subCBs).not(matchThis); // Would be nice to split the subCBs
+                                    if (subsAccumulating == null || subsAccumulating.length == 0)
+                                        subsAccumulating = subBatch;
+                                    else
+                                        subsAccumulating = subsAccumulating.add(subBatch);
+                                }
+                            }
+                            subCBs = subsAccumulating;
+                        }
+                    } else
                 subCBs = $(subCBs).filter(matchClasses);
             }
         }
     }
+    }
 
     // Walk through all selected subCBs to get other related tags
     var possibleSelections = [ ];  // empty array
     if(!oneEmpty) {
         $( subCBs ).each( function (i)  {
 
             var possibleClasses = $( this ).attr("class").split(" ");
             if( $(possibleClasses).length > 0)
                 possibleClasses = aryRemoveVals(possibleClasses,[ "subCB" ]);
             if( $(possibleClasses).length > 0)
                 possibleSelections = possibleSelections.concat(possibleClasses);
         });
         if( $ (possibleSelections).length > 0) // clean out tags from other dimensions
             possibleSelections = aryRemoveVals(possibleSelections,allSelectedTags);
     }