Using class-based show/hide instead of the jquery/prototype methods results in significant speed improvements for very, very large select boxes. (at least in modern web browsers)

This commit is contained in:
Patrick Filler 2011-09-29 15:39:45 -04:00
parent 953d3baa4f
commit d4c7005b5c
7 changed files with 13 additions and 10 deletions

View file

@ -233,6 +233,7 @@
padding: 0;
}
.chzn-container .chzn-results li {
display: none;
line-height: 80%;
padding: 7px 7px 8px;
margin: 0;
@ -240,6 +241,7 @@
}
.chzn-container .chzn-results .active-result {
cursor: pointer;
display: list-item;
}
.chzn-container .chzn-results .highlighted {
background: #3875d7;
@ -254,6 +256,7 @@
}
.chzn-container .chzn-results .no-results {
background: #f4f4f4;
display: list-item;
}
.chzn-container .chzn-results .group-result {
cursor: default;

View file

@ -489,10 +489,10 @@
}
};
Chosen.prototype.result_activate = function(el) {
return el.addClass("active-result").show();
return el.addClass("active-result");
};
Chosen.prototype.result_deactivate = function(el) {
return el.removeClass("active-result").hide();
return el.removeClass("active-result");
};
Chosen.prototype.result_deselect = function(pos) {
var result, result_data;

File diff suppressed because one or more lines are too long

View file

@ -484,10 +484,10 @@
}
};
Chosen.prototype.result_activate = function(el) {
return el.addClassName("active-result").show();
return el.addClassName("active-result");
};
Chosen.prototype.result_deactivate = function(el) {
return el.removeClassName("active-result").hide();
return el.removeClassName("active-result");
};
Chosen.prototype.result_deselect = function(pos) {
var result, result_data;

File diff suppressed because one or more lines are too long

View file

@ -402,10 +402,10 @@ class Chosen
this.search_field_scale()
result_activate: (el) ->
el.addClass("active-result").show()
el.addClass("active-result")
result_deactivate: (el) ->
el.removeClass("active-result").hide()
el.removeClass("active-result")
result_deselect: (pos) ->
result_data = @results_data[pos]

View file

@ -395,10 +395,10 @@ class Chosen
this.search_field_scale()
result_activate: (el) ->
el.addClassName("active-result").show()
el.addClassName("active-result")
result_deactivate: (el) ->
el.removeClassName("active-result").hide()
el.removeClassName("active-result")
result_deselect: (pos) ->
result_data = @results_data[pos]