Skip to content

Commit

Permalink
prevent setting negative size. Fixes metafizzy#38
Browse files Browse the repository at this point in the history
negative size causes error in IE
  • Loading branch information
desandro committed May 14, 2013
1 parent 0546047 commit 994d648
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "packery",
"version": "1.0.4",
"version": "1.0.5",
"author": "David DeSandro / Metafizzy",
"description": "bin-packing layout library",
"main": [
Expand Down
4 changes: 3 additions & 1 deletion js/packery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Packery v1.0.4
* Packery v1.0.5
* bin-packing layout library
* http://packery.metafizzy.co
*
Expand Down Expand Up @@ -357,6 +357,8 @@ Packery.prototype.layoutItems = function( items, isInstant ) {
elemH += elemSize.paddingBottom + elemSize.paddingTop +
elemSize.borderTopWidth + elemSize.borderBottomWidth;
}
// prevent negative size, which causes error in IE
elemH = Math.max( elemH, 0 );
this.element.style.height = elemH + 'px';
};

Expand Down
2 changes: 2 additions & 0 deletions test/defaults-empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ test( 'defaults / empty', function() {
return true; // bind once
});
stop();
// add gutter, to check that container size doesn't get negative number
pckry.options.gutter = 20;
pckry.layout();
});

Expand Down

0 comments on commit 994d648

Please sign in to comment.