Skip to content

Commit 5b161b0

Browse files
committed
ensure vars are declared out of loop and are not out of scope
1 parent 60f7a82 commit 5b161b0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/jquery.columnizer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@
427427
// options that would cause an infinite loop, then this'll definitely stop it.
428428
for(var loopCount=0;loopCount<maxLoops && maxLoops < 20;loopCount++){
429429
$inBox.empty();
430-
var $destroyable;
430+
var $destroyable, className, $col, $lastKid;
431431
try{
432432
$destroyable = $cache.clone(true);
433433
}catch(e){
@@ -438,7 +438,7 @@
438438
// create the columns
439439
for (var i = 0; i < numCols; i++) {
440440
/* create column */
441-
var className = (i === 0) ? prefixTheClassName("first") : "";
441+
className = (i === 0) ? prefixTheClassName("first") : "";
442442
className += " " + prefixTheClassName("column");
443443
className = (i == numCols - 1) ? (prefixTheClassName("last") + " " + className) : className;
444444
$inBox.append($("<div class='" + className + "' style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
@@ -451,7 +451,7 @@
451451
// we ran out of columns, make another
452452
$inBox.append($("<div class='" + className + "' style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
453453
}
454-
var $col = $inBox.children().eq(i);
454+
$col = $inBox.children().eq(i);
455455
if(scrollHorizontally){
456456
$col.width(optionWidth + "px");
457457
}
@@ -460,7 +460,7 @@
460460
split($col, $destroyable, $col, targetHeight);
461461

462462
while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
463-
var $lastKid = $col.contents(":last");
463+
$lastKid = $col.contents(":last");
464464
$lastKid.remove();
465465
$destroyable.prepend($lastKid);
466466
}

0 commit comments

Comments
 (0)