diff --git a/autosize.jquery.json b/autosize.jquery.json
index 1b19517..1be4c9e 100644
--- a/autosize.jquery.json
+++ b/autosize.jquery.json
@@ -7,7 +7,7 @@
"textarea",
"ui"
],
- "version": "1.16.6",
+ "version": "1.16.7",
"author": {
"name": "Jack Moore",
"url": "http://www.jacklmoore.com",
diff --git a/component.json b/component.json
index 19a5c92..f31583c 100644
--- a/component.json
+++ b/component.json
@@ -1,6 +1,6 @@
{
"name": "jquery-autosize",
- "version": "1.16.6",
+ "version": "1.16.7",
"main": "./jquery.autosize.js",
"dependencies": {
"jquery": ">=1.7"
diff --git a/jquery.autosize-min.js b/jquery.autosize-min.js
index e646a5f..b4303a6 100644
--- a/jquery.autosize-min.js
+++ b/jquery.autosize-min.js
@@ -1,7 +1,7 @@
-/*
- jQuery Autosize v1.16.6
+/*!
+ jQuery Autosize v1.16.7
(c) 2013 Jack Moore - jacklmoore.com
- updated: 2013-03-12
+ updated: 2013-03-20
license: http://www.opensource.org/licenses/mit-license.php
*/
-(function(e){var t,o={className:"autosizejs",append:"",callback:!1},n="hidden",i="border-box",s="lineHeight",a='',r=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],l="oninput",c="onpropertychange",h=e(a).data("autosize",!0)[0];h.style.lineHeight="99px","99px"===e(h).css(s)&&r.push(s),h.style.lineHeight="",e.fn.autosize=function(s){return s=e.extend({},o,s||{}),h.parentNode!==document.body&&e(document.body).append(h),this.each(function(){function o(){t=b,h.className=s.className,e.each(r,function(e,t){h.style[t]=f.css(t)})}function a(){var e,i,a;if(t!==b&&o(),!d){d=!0,h.value=b.value+s.append,h.style.overflowY=b.style.overflowY,a=parseInt(b.style.height,10),h.style.width=Math.max(f.width(),0)+"px",h.scrollTop=0,h.scrollTop=9e4,e=h.scrollTop;var r=parseInt(f.css("maxHeight"),10);r=r&&r>0?r:9e4,e>r?(e=r,i="scroll"):p>e&&(e=p),e+=g,b.style.overflowY=i||n,a!==e&&(b.style.height=e+"px",x&&s.callback.call(b)),setTimeout(function(){d=!1},1)}}var p,d,u,b=this,f=e(b),g=0,x=e.isFunction(s.callback);f.data("autosize")||((f.css("box-sizing")===i||f.css("-moz-box-sizing")===i||f.css("-webkit-box-sizing")===i)&&(g=f.outerHeight()-f.height()),p=Math.max(parseInt(f.css("minHeight"),10)-g,f.height()),u="none"===f.css("resize")||"vertical"===f.css("resize")?"none":"horizontal",f.css({overflow:n,overflowY:n,wordWrap:"break-word",resize:u}).data("autosize",!0),c in b?l in b?b[l]=b.onkeyup=a:b[c]=a:b[l]=a,e(window).on("resize",function(){d=!1,a()}),f.on("autosize",function(){d=!1,a()}),a())})}})(window.jQuery||window.Zepto);
\ No newline at end of file
+(function(e){var t,o,n={className:"autosizejs",append:"",callback:!1},i="hidden",s="border-box",a="lineHeight",l='',r=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],c="oninput",h="onpropertychange",p=e(l).data("autosize",!0)[0];p.style.lineHeight="99px","99px"===e(p).css(a)&&r.push(a),p.style.lineHeight="",e.fn.autosize=function(a){return a=e.extend({},n,a||{}),p.parentNode!==document.body&&(e(document.body).append(p),p.value="\n\n\n",p.scrollTop=9e4,t=p.scrollHeight===p.scrollTop+p.clientHeight),this.each(function(){function n(){o=b,p.className=a.className,e.each(r,function(e,t){p.style[t]=f.css(t)})}function l(){var e,s,l;if(o!==b&&n(),!d){d=!0,p.value=b.value+a.append,p.style.overflowY=b.style.overflowY,l=parseInt(b.style.height,10),p.style.width=Math.max(f.width(),0)+"px",t?e=p.scrollHeight:(p.scrollTop=0,p.scrollTop=9e4,e=p.scrollTop);var r=parseInt(f.css("maxHeight"),10);r=r&&r>0?r:9e4,e>r?(e=r,s="scroll"):u>e&&(e=u),e+=x,b.style.overflowY=s||i,l!==e&&(b.style.height=e+"px",w&&a.callback.call(b)),setTimeout(function(){d=!1},1)}}var u,d,g,b=this,f=e(b),x=0,w=e.isFunction(a.callback);f.data("autosize")||((f.css("box-sizing")===s||f.css("-moz-box-sizing")===s||f.css("-webkit-box-sizing")===s)&&(x=f.outerHeight()-f.height()),u=Math.max(parseInt(f.css("minHeight"),10)-x,f.height()),g="none"===f.css("resize")||"vertical"===f.css("resize")?"none":"horizontal",f.css({overflow:i,overflowY:i,wordWrap:"break-word",resize:g}).data("autosize",!0),h in b?c in b?b[c]=b.onkeyup=l:b[h]=l:b[c]=l,e(window).on("resize",function(){d=!1,l()}),f.on("autosize",function(){d=!1,l()}),l())})}})(window.jQuery||window.Zepto);
\ No newline at end of file
diff --git a/jquery.autosize.js b/jquery.autosize.js
index 1055a6a..fc7f75c 100644
--- a/jquery.autosize.js
+++ b/jquery.autosize.js
@@ -1,12 +1,11 @@
-/*
- jQuery Autosize v1.16.6
+/*!
+ jQuery Autosize v1.16.7
(c) 2013 Jack Moore - jacklmoore.com
- updated: 2013-03-12
+ updated: 2013-03-20
license: http://www.opensource.org/licenses/mit-license.php
*/
-
(function ($) {
var
defaults = {
@@ -17,6 +16,7 @@
hidden = 'hidden',
borderBox = 'border-box',
lineHeight = 'lineHeight',
+ supportsScrollHeight,
// border:0 is unnecessary, but avoids a bug in FireFox on OSX (http://www.jacklmoore.com/autosize#comment-851)
copy = '',
@@ -53,6 +53,10 @@
if (mirror.parentNode !== document.body) {
$(document.body).append(mirror);
+
+ mirror.value = "\n\n\n";
+ mirror.scrollTop = 9e4;
+ supportsScrollHeight = mirror.scrollHeight === mirror.scrollTop + mirror.clientHeight;
}
return this.each(function () {
@@ -120,10 +124,13 @@
// 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;
- mirror.scrollTop = 9e4;
- height = mirror.scrollTop;
+ if (supportsScrollHeight) {
+ height = mirror.scrollHeight;
+ } else { // IE6 & IE7
+ mirror.scrollTop = 0;
+ mirror.scrollTop = 9e4;
+ height = mirror.scrollTop;
+ }
var maxHeight = parseInt($ta.css('maxHeight'), 10);
// Opera returns '-1px' when max-height is set to 'none'.
diff --git a/readme.md b/readme.md
index 6df9405..c4d037d 100644
--- a/readme.md
+++ b/readme.md
@@ -4,6 +4,9 @@ Small jQuery plugin to allow dynamic resizing of textarea height, so that it gro
## Changelog
+### v1.16.7 - 2013/3/20
+* Added workaround for a very edge-case iOS bug (Fixes #58).
+
### v1.16.6 - 2013/3/12
* Replaced jQuery shorthand methods with on() in anticipation of jQuery 2.0 conditional builds