Skip to content

Commit ba4f350

Browse files
committed
fixed empty <table> at end of column #182
1 parent 1fabf1f commit ba4f350

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

samples/sample8.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
$(function(){
1919
$('.colz').addClass("dontsplit");
2020
$('.enclosure').columnize({
21-
width : 300
21+
width : 300,
22+
lastNeverTallest: true
2223
});
2324
});
2425
</script>

src/jquery.columnizer.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,20 @@
343343
// it was split, but nothing is in it :(
344344
$clone.remove();
345345
$cloneMe.removeClass(prefixTheClassName("split"));
346-
}
346+
}else if($clone.get(0).childNodes.length == 1){
347+
// was the only child node a text node w/ whitespace?
348+
var onlyNode = $clone.get(0).childNodes[0];
349+
if(onlyNode.nodeType == 3){
350+
// text node
351+
var whitespace = /\s/;
352+
var str = onlyNode.nodeValue;
353+
if(whitespace.test(str)){
354+
// yep, only a whitespace textnode
355+
$clone.remove();
356+
$cloneMe.removeClass(prefixTheClassName("split"));
357+
}
358+
}
359+
}
347360
}
348361
}
349362
}

src/jquery.columnizer.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)