diff --git a/autosize.jquery.json b/autosize.jquery.json
index 207466e..103401e 100644
--- a/autosize.jquery.json
+++ b/autosize.jquery.json
@@ -2,7 +2,7 @@
"name": "autosize",
"title": "Autosize",
"description": "Automatically adjust textarea height based on user input.",
- "version": "1.17.3",
+ "version": "1.17.4",
"dependencies": {
"jquery": ">=1.7"
},
diff --git a/bower.json b/bower.json
index d088b46..f2bf6b9 100644
--- a/bower.json
+++ b/bower.json
@@ -1,7 +1,7 @@
{
"name": "jquery-autosize",
"description": "Automatically adjust textarea height based on user input.",
- "version": "1.17.3",
+ "version": "1.17.4",
"dependencies": {
"jquery": ">=1.7"
},
diff --git a/jquery.autosize.js b/jquery.autosize.js
index 18d537d..3fe9ce1 100644
--- a/jquery.autosize.js
+++ b/jquery.autosize.js
@@ -1,5 +1,5 @@
/*!
- Autosize v1.17.3 - 2013-08-21
+ Autosize v1.17.4 - 2013-08-22
Automatically adjust textarea height based on user input.
(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
license: http://www.opensource.org/licenses/mit-license.php
@@ -111,6 +111,23 @@
});
$(mirror).css(styles);
+ // window.getComputedStyle, getBoundingClientRect returning a width are unsupported/unneeded in IE8 and lower.
+ // The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
+ if ('getComputedStyle' in window) {
+ var style = window.getComputedStyle(ta);
+ var width = ta.getBoundingClientRect().width;
+
+ $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
+ width -= parseInt(style[val],10);
+ });
+
+ mirror.style.width = width + 'px';
+ }
+ else {
+ mirror.style.width = Math.max($ta.width(), 0) + 'px';
+ }
+
+ // This code block fixes a Chrome-specific issue:
// The textarea overflow is probably now hidden, but Chrome doesn't reflow the text to account for the
// new space made available by removing the scrollbars. This workaround causes Chrome to reflow the text.
if ('oninput' in ta && 'setSelectionRange' in ta) {
@@ -124,7 +141,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, width, style;
+ var height, original;
if (mirrored !== ta) {
initMirror();
@@ -134,22 +151,6 @@
mirror.style.overflowY = ta.style.overflowY;
original = parseInt(ta.style.height,10);
- // window.getComputedStyle, getBoundingClientRect returning a width are unsupported in IE8 and lower.
- // The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
- if ('getComputedStyle' in window) {
- style = window.getComputedStyle(ta);
- width = ta.getBoundingClientRect().width;
-
- $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
- width -= parseInt(style[val],10);
- });
-
- mirror.style.width = width + 'px';
- }
- else {
- mirror.style.width = Math.max($ta.width(), 0) + 'px';
- }
-
// Needed for IE8 and lower to reliably return the correct scrollTop
mirror.scrollTop = 0;
@@ -181,7 +182,10 @@
function resize () {
clearTimeout(timeout);
timeout = setTimeout(function(){
- if ($ta.width() !== width) {
+ var newWidth = $ta.width();
+
+ if (newWidth !== width) {
+ width = newWidth;
adjust();
}
}, parseInt(options.resizeDelay,10));
diff --git a/jquery.autosize.min.js b/jquery.autosize.min.js
index 9fdf4c6..0446e6d 100644
--- a/jquery.autosize.min.js
+++ b/jquery.autosize.min.js
@@ -1,7 +1,7 @@
/*!
- Autosize v1.17.3 - 2013-08-21
+ Autosize v1.17.4 - 2013-08-22
Automatically adjust textarea height based on user input.
(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
license: http://www.opensource.org/licenses/mit-license.php
*/
-(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(window.jQuery||window.$)})(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var o={};if(t=u,s.className=i.className,l=parseInt(h.css("maxHeight"),10),e.each(n,function(e,t){o[t]=h.css(t)}),e(s).css(o),"oninput"in u&&"setSelectionRange"in u){var a=u.selectionStart;u.value+=" ",u.value=u.value.slice(0,-1),u.setSelectionRange(a,a)}}function a(){var n,a,r,d;t!==u&&o(),s.value=u.value+i.append,s.style.overflowY=u.style.overflowY,a=parseInt(u.style.height,10),"getComputedStyle"in window?(d=window.getComputedStyle(u),r=u.getBoundingClientRect().width,e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,t){r-=parseInt(d[t],10)}),s.style.width=r+"px"):s.style.width=Math.max(h.width(),0)+"px",s.scrollTop=0,s.scrollTop=9e4,n=s.scrollTop,l&&n>l?(u.style.overflowY="scroll",n=l):(u.style.overflowY="hidden",c>n&&(n=c)),n+=p,a!==n&&(u.style.height=n+"px",f&&i.callback.call(u,u))}function r(){clearTimeout(d),d=setTimeout(function(){h.width()!==z&&a()},parseInt(i.resizeDelay,10))}var l,c,d,u=this,h=e(u),p=0,f=e.isFunction(i.callback),w={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},z=h.width();h.data("autosize")||(h.data("autosize",!0),("border-box"===h.css("box-sizing")||"border-box"===h.css("-moz-box-sizing")||"border-box"===h.css("-webkit-box-sizing"))&&(p=h.outerHeight()-h.height()),c=Math.max(parseInt(h.css("minHeight"),10)-p||0,h.height()),h.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===h.css("resize")||"vertical"===h.css("resize")?"none":"horizontal"}),"onpropertychange"in u?"oninput"in u?h.on("input.autosize keyup.autosize",a):h.on("propertychange.autosize",function(){"value"===event.propertyName&&a()}):h.on("input.autosize",a),i.resizeDelay!==!1&&e(window).on("resize.autosize",r),h.on("autosize.resize",a),h.on("autosize.resizeIncludeStyle",function(){t=null,a()}),h.on("autosize.destroy",function(){t=null,clearTimeout(d),e(window).off("resize",r),h.off("autosize").off(".autosize").css(w).removeData("autosize")}),a())})}});
\ No newline at end of file
+(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(window.jQuery||window.$)})(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var o={};if(t=u,s.className=i.className,l=parseInt(h.css("maxHeight"),10),e.each(n,function(e,t){o[t]=h.css(t)}),e(s).css(o),"getComputedStyle"in window){var a=window.getComputedStyle(u),r=u.getBoundingClientRect().width;e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,t){r-=parseInt(a[t],10)}),s.style.width=r+"px"}else s.style.width=Math.max(h.width(),0)+"px";if("oninput"in u&&"setSelectionRange"in u){var c=u.selectionStart;u.value+=" ",u.value=u.value.slice(0,-1),u.setSelectionRange(c,c)}}function a(){var e,n;t!==u&&o(),s.value=u.value+i.append,s.style.overflowY=u.style.overflowY,n=parseInt(u.style.height,10),s.scrollTop=0,s.scrollTop=9e4,e=s.scrollTop,l&&e>l?(u.style.overflowY="scroll",e=l):(u.style.overflowY="hidden",c>e&&(e=c)),e+=p,n!==e&&(u.style.height=e+"px",f&&i.callback.call(u,u))}function r(){clearTimeout(d),d=setTimeout(function(){var e=h.width();e!==z&&(z=e,a())},parseInt(i.resizeDelay,10))}var l,c,d,u=this,h=e(u),p=0,f=e.isFunction(i.callback),w={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},z=h.width();h.data("autosize")||(h.data("autosize",!0),("border-box"===h.css("box-sizing")||"border-box"===h.css("-moz-box-sizing")||"border-box"===h.css("-webkit-box-sizing"))&&(p=h.outerHeight()-h.height()),c=Math.max(parseInt(h.css("minHeight"),10)-p||0,h.height()),h.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===h.css("resize")||"vertical"===h.css("resize")?"none":"horizontal"}),"onpropertychange"in u?"oninput"in u?h.on("input.autosize keyup.autosize",a):h.on("propertychange.autosize",function(){"value"===event.propertyName&&a()}):h.on("input.autosize",a),i.resizeDelay!==!1&&e(window).on("resize.autosize",r),h.on("autosize.resize",a),h.on("autosize.resizeIncludeStyle",function(){t=null,a()}),h.on("autosize.destroy",function(){t=null,clearTimeout(d),e(window).off("resize",r),h.off("autosize").off(".autosize").css(w).removeData("autosize")}),a())})}});
\ No newline at end of file
diff --git a/package.json b/package.json
index c331cce..5ae8dd4 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "jquery-autosize",
"description": "Automatically adjust textarea height based on user input.",
- "version": "1.17.3",
+ "version": "1.17.4",
"dependencies": {},
"keywords": [
"form",
diff --git a/readme.md b/readme.md
index cb71337..d1b800d 100644
--- a/readme.md
+++ b/readme.md
@@ -4,8 +4,12 @@ Small jQuery plugin to allow dynamic resizing of textarea height, so that it gro
## Changelog
-### v1.17.3 - 2013/8/21
-* Resolved an issue that was causing slowing down initialization for text-intensive textareas in Chrome.
+### v1.17.4 - 2013/8/22
+* Improved speed of editing large blocks of text in FireFox.
+* No longer accounts for changes in width for a textarea while typing in order to improve performance.
+
+### v1.17.3 - 2013/8/2013
+* Resolved an issue that was causing slowing down initialization for large blocks of text in Chrome.
* Renamed minified file from jquery.autosize-min.js to jquery.autosize.min.js
### v1.17.2 - 2013/7/28