summaryrefslogtreecommitdiffstats
path: root/slick.grid.js
diff options
context:
space:
mode:
authormleibman <michael.leibman@gmail.com>2012-06-01 11:20:36 -0700
committermleibman <michael.leibman@gmail.com>2012-06-01 11:20:36 -0700
commit36cd54e247ea0dd8175f9ae6a8d7585e15e600a6 (patch)
tree966f3709ad3f293b9e9a2126c9d1eafd0dffef3d /slick.grid.js
parentb528225c140cecc47322f9d21f50b127dffa12eb (diff)
downloadSlickGrid-36cd54e247ea0dd8175f9ae6a8d7585e15e600a6.zip
SlickGrid-36cd54e247ea0dd8175f9ae6a8d7585e15e600a6.tar.gz
SlickGrid-36cd54e247ea0dd8175f9ae6a8d7585e15e600a6.tar.bz2
Sped up getMaxSupportedCssHeight() by doing exponential testing instead of linear.
Diffstat (limited to 'slick.grid.js')
-rw-r--r--slick.grid.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/slick.grid.js b/slick.grid.js
index b0b1fb2..b9e6da2 100644
--- a/slick.grid.js
+++ b/slick.grid.js
@@ -376,18 +376,18 @@ if (typeof Slick === "undefined") {
}
function getMaxSupportedCssHeight() {
- var increment = 1000000;
- var supportedHeight = increment;
+ var supportedHeight = 1000000;
// FF reports the height back but still renders blank after ~6M px
- var testUpTo = ($.browser.mozilla) ? 5000000 : 1000000000;
+ var testUpTo = ($.browser.mozilla) ? 6000000 : 1000000000;
var div = $("<div style='display:none' />").appendTo(document.body);
- while (supportedHeight <= testUpTo) {
- div.css("height", supportedHeight + increment);
- if (div.height() !== supportedHeight + increment) {
+ while (true) {
+ var test = supportedHeight * 2;
+ div.css("height", test);
+ if (test > testUpTo || div.height() !== test) {
break;
} else {
- supportedHeight += increment;
+ supportedHeight = test;
}
}