diff options
author | Jack Moore <hello@jacklmoore.com> | 2014-12-09 10:09:15 -0500 |
---|---|---|
committer | Jack Moore <hello@jacklmoore.com> | 2014-12-09 10:09:15 -0500 |
commit | 7db2c222b5c98de1f9b17dd3fc1f9a795f7d394f (patch) | |
tree | 71e75e9873b7b84bf33175e723d41bafbdffbfd2 | |
parent | 74b792e6801f680c9c79ace8d4b07c9c1b3993e8 (diff) | |
parent | 77974fdcc4aaad79788e0a421144375824e70d9d (diff) | |
download | autosize-7db2c222b5c98de1f9b17dd3fc1f9a795f7d394f.zip autosize-7db2c222b5c98de1f9b17dd3fc1f9a795f7d394f.tar.gz autosize-7db2c222b5c98de1f9b17dd3fc1f9a795f7d394f.tar.bz2 |
Merge pull request #189 from njam/float-comparison
Treat height differences smaller than 1/100px as equal
-rw-r--r-- | jquery.autosize.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/jquery.autosize.js b/jquery.autosize.js index 8f1c798..2ff016d 100644 --- a/jquery.autosize.js +++ b/jquery.autosize.js @@ -157,7 +157,7 @@ // Using mainly bare JS in this function because it is going // to fire very often while typing, and needs to very efficient. function adjust() { - var height, original; + var height, originalHeight; if (mirrored !== ta) { initMirror(); @@ -176,7 +176,7 @@ mirror.value += options.append || ''; mirror.style.overflowY = ta.style.overflowY; - original = parseFloat(ta.style.height); + originalHeight = parseFloat(ta.style.height) || 0; // Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied mirror.scrollTop = 0; @@ -198,7 +198,7 @@ height += boxOffset; - if (original !== height) { + if (Math.abs(originalHeight - height) > 1/100) { ta.style.height = height + 'px'; // Trigger a repaint for IE8 for when ta is nested 2 or more levels inside an inline-block |