Skip to content

Commit

Permalink
Fixed bug with overflow detection which degraded performance of texta…
Browse files Browse the repository at this point in the history
…reas that exceed their max-width. Fixes jackmoore#333.
  • Loading branch information
jackmoore committed May 19, 2017
1 parent 29ca460 commit 5284a46
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

##### v.3.0.21 - 2016-05-19
* Fixed bug with overflow detection which degraded performance of textareas that exceed their max-width. Fixes #333.

##### v.3.0.20 - 2016-12-04
* Fixed minor bug where the `resized` event would not fire under specific conditions when changing the overflow.

Expand Down
8 changes: 4 additions & 4 deletions dist/autosize.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
Autosize 3.0.20
Autosize 3.0.21
license: MIT
http://www.jacklmoore.com/autosize
*/
Expand Down Expand Up @@ -161,10 +161,10 @@
var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;

// The actual height not matching the style height (set via the resize method) indicates that
// the max-height has been exceeded, in which case the overflow should be set to visible.
// the max-height has been exceeded, in which case the overflow should be allowed.
if (actualHeight !== styleHeight) {
if (computed.overflowY !== 'visible') {
changeOverflow('visible');
if (computed.overflowY === 'hidden') {
changeOverflow('scroll');
resize();
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
}
Expand Down
4 changes: 2 additions & 2 deletions dist/autosize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "autosize",
"description": "Autosize is a small, stand-alone script to automatically adjust textarea height to fit text.",
"version": "3.0.20",
"version": "3.0.21",
"keywords": [
"textarea",
"form",
Expand Down
6 changes: 3 additions & 3 deletions src/autosize.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ function assign(ta) {
var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;

// The actual height not matching the style height (set via the resize method) indicates that
// the max-height has been exceeded, in which case the overflow should be set to visible.
// the max-height has been exceeded, in which case the overflow should be allowed.
if (actualHeight !== styleHeight) {
if (computed.overflowY !== 'visible') {
changeOverflow('visible');
if (computed.overflowY === 'hidden') {
changeOverflow('scroll');
resize();
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
}
Expand Down

0 comments on commit 5284a46

Please sign in to comment.