diff --git a/autosize.jquery.json b/autosize.jquery.json new file mode 100644 index 0000000..479305a --- /dev/null +++ b/autosize.jquery.json @@ -0,0 +1,24 @@ +{ + "name": "autosize", + "title": "Autosize", + "description": "enables automatic height for textarea elements", + "keywords": [ + "form", + "textarea", + "ui" + ], + "version": "1.15.0", + "author": { + "name": "Jack Moore", + "url": "http://www.jacklmoore.com" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + } + ], + "homepage": "http://jacklmoore.com/autosize", + "demo": "http://jacklmoore.com/autosize", + "dependencies": { "jquery": ">=1.4" } +} \ No newline at end of file diff --git a/jquery.autosize.js b/jquery.autosize.js index 3bda005..a29edc1 100644 --- a/jquery.autosize.js +++ b/jquery.autosize.js @@ -65,8 +65,7 @@ return; } - minHeight = parseInt($ta.css('minHeight'), 10); - minHeight = minHeight || $ta.height(); + minHeight = parseInt($ta.css('minHeight'), 10) || $ta.height(); if ($ta.css('box-sizing') === borderBox || $ta.css('-moz-box-sizing') === borderBox || $ta.css('-webkit-box-sizing') === borderBox){ boxOffset = $ta.outerHeight() - $ta.height(); @@ -113,7 +112,8 @@ original = parseInt(ta.style.height,10); // Update the width in case the original textarea width has changed - mirror.style.width = ($ta.width() < 0 ? 0 : $ta.width()) + 'px'; + // A floor of 0 is needed because IE8 returns a negative value for hidden textareas, raising an error. + mirror.style.width = Math.max($ta.width(), 0) + 'px'; // The following three lines can be replaced with `height = mirror.scrollHeight` when dropping IE7 support. mirror.scrollTop = 0;