Skip to content

Commit

Permalink
Minor change to logic for applying the CSS resize property. Fixes jac…
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmoore committed May 20, 2014
1 parent 6e57975 commit 2fe25af
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion autosize.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "autosize",
"title": "Autosize",
"description": "Automatically adjust textarea height based on user input.",
"version": "1.18.7",
"version": "1.18.8",
"dependencies": {
"jquery": ">=1.7"
},
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery-autosize",
"description": "Automatically adjust textarea height based on user input.",
"version": "1.18.7",
"version": "1.18.8",
"dependencies": {
"jquery": ">=1.7"
},
Expand Down
14 changes: 10 additions & 4 deletions jquery.autosize.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
Autosize v1.18.7 - 2014-04-13
Autosize v1.18.8 - 2014-05-20
Automatically adjust textarea height based on user input.
(c) 2014 Jack Moore - http://www.jacklmoore.com/autosize
license: http://www.opensource.org/licenses/mit-license.php
Expand Down Expand Up @@ -70,7 +70,8 @@
resize: ta.style.resize
},
timeout,
width = $ta.width();
width = $ta.width(),
taResize = $ta.css('resize');

if ($ta.data('autosize')) {
// exit if autosize has already been applied, or if the textarea is the mirror element.
Expand All @@ -88,10 +89,15 @@
$ta.css({
overflow: 'hidden',
overflowY: 'hidden',
wordWrap: 'break-word', // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
resize: ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal'
wordWrap: 'break-word' // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
});

if (taResize === 'vertical') {
$ta.css('resize','none');
} else if (taResize === 'both') {
$ta.css('resize', 'horizontal');
}

// The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
// window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower.
function setWidth() {
Expand Down
4 changes: 2 additions & 2 deletions jquery.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": "jquery-autosize",
"description": "Automatically adjust textarea height based on user input.",
"version": "1.18.7",
"version": "1.18.8",
"dependencies": {},
"keywords": [
"form",
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Small jQuery plugin to allow dynamic resizing of textarea height, so that it gro

## Changelog

### v1.18.8 - 2014/5/20
* Minor change to logic for applying the CSS resize property. Fixes #156

### v1.18.7 - 2014/4/13
* Very minor change to better represent condition for taking the element width from the style object. Fixes #147
* Added a newline character by default to the textarea element for smoother behavior in IE. Reference #148
Expand Down

0 comments on commit 2fe25af

Please sign in to comment.