vendor/assets/javascripts/jquery.autosize.js in autosize-rails-1.18.4 vs vendor/assets/javascripts/jquery.autosize.js in autosize-rails-1.18.6
- old
+ new
@@ -1,15 +1,16 @@
/*!
- Autosize v1.18.4 - 2014-01-11
+ Autosize v1.18.6 - 2014-03-13
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
*/
(function ($) {
var
defaults = {
className: 'autosizejs',
+ id: 'autosizejs',
append: '',
callback: false,
resizeDelay: 10,
placeholder: true
},
@@ -118,22 +119,24 @@
function initMirror() {
var styles = {};
mirrored = ta;
mirror.className = options.className;
+ mirror.id = options.id;
maxHeight = parseInt($ta.css('maxHeight'), 10);
// mirror is a duplicate textarea located off-screen that
// is automatically updated to contain the same text as the
// original textarea. mirror always has a height of 0.
// This gives a cross-browser supported way getting the actual
// height of the text, through the scrollTop property.
$.each(typographyStyles, function(i,val){
styles[val] = $ta.css(val);
});
- $(mirror).css(styles);
+ $(mirror).css(styles).attr('wrap', $ta.attr('wrap'));
+
setWidth();
// Chrome-specific fix:
// When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
// made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
@@ -158,10 +161,10 @@
if (!ta.value && options.placeholder) {
// If the textarea is empty, copy the placeholder text into
// the mirror control and use that for sizing so that we
// don't end up with placeholder getting trimmed.
- mirror.value = ($(ta).attr("placeholder") || '') + options.append;
+ mirror.value = ($ta.attr("placeholder") || '') + options.append;
} else {
mirror.value = ta.value + options.append;
}
mirror.style.overflowY = ta.style.overflowY;