autosize-rails 1.18.8 → 1.18.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8705bce18670d6e76566e32d8e705898e7ee1cdb
4
- data.tar.gz: a3c474ce295904f4bd5135c5d375d0f9a6ec71b0
3
+ metadata.gz: b3386a162901d494796135d75b810a8606f324bd
4
+ data.tar.gz: dbaaf8645821f067c4b91f27afebebb17cc5dd8a
5
5
  SHA512:
6
- metadata.gz: f60ffdc75eee05f93bce60f26f494491976fa0d8b7fc604b4a2419e6ff743d9ecbaf10d85d57341f48bba5eceadae7ca078b93dd2169ef4fe265840af7f3dab0
7
- data.tar.gz: b25a31b154f17f6bdbc5554e9e0944d73e330f3aac1a9a7fae0d77109e5748ee579cfb0dacae067d8caa8a8980a61c9405949e2fbb7af64c46a7611e65391ed4
6
+ metadata.gz: b2861edbedde17e17b6f7330d325966d242755c2e765300b36e8b8f65446a6920d321042c915906fc4fa94d25423c4e797c21a1cf44d8aae1a3f04c98e1f1904
7
+ data.tar.gz: a2649322701b4cfb1ce5ab77f9c103d03647f2c0eb87a5a024d1efcda8a3ea02a23d0ab6297bb6333f276db570c043ded2a7e868c22873fce200e4e6f19735ce
@@ -1,5 +1,5 @@
1
1
  module Autosize
2
2
  module Rails
3
- VERSION = "1.18.8"
3
+ VERSION = "1.18.15"
4
4
  end
5
5
  end
@@ -1,8 +1,7 @@
1
1
  /*!
2
- Autosize v1.18.8 - 2014-05-20
3
- Automatically adjust textarea height based on user input.
4
- (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize
5
- license: http://www.opensource.org/licenses/mit-license.php
2
+ Autosize 1.18.15
3
+ license: MIT
4
+ http://www.jacklmoore.com/autosize
6
5
  */
7
6
  (function ($) {
8
7
  var
@@ -27,7 +26,8 @@
27
26
  'letterSpacing',
28
27
  'textTransform',
29
28
  'wordSpacing',
30
- 'textIndent'
29
+ 'textIndent',
30
+ 'whiteSpace'
31
31
  ],
32
32
 
33
33
  // to keep track which textarea is being mirrored when adjust() is called.
@@ -84,7 +84,7 @@
84
84
  }
85
85
 
86
86
  // IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
87
- minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
87
+ minHeight = Math.max(parseFloat($ta.css('minHeight')) - boxOffset || 0, $ta.height());
88
88
 
89
89
  $ta.css({
90
90
  overflow: 'hidden',
@@ -103,23 +103,23 @@
103
103
  function setWidth() {
104
104
  var width;
105
105
  var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;
106
-
106
+
107
107
  if (style) {
108
108
 
109
109
  width = ta.getBoundingClientRect().width;
110
110
 
111
111
  if (width === 0 || typeof width !== 'number') {
112
- width = parseInt(style.width,10);
112
+ width = parseFloat(style.width);
113
113
  }
114
114
 
115
115
  $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
116
- width -= parseInt(style[val],10);
116
+ width -= parseFloat(style[val]);
117
117
  });
118
118
  } else {
119
- width = Math.max($ta.width(), 0);
119
+ width = $ta.width();
120
120
  }
121
121
 
122
- mirror.style.width = width + 'px';
122
+ mirror.style.width = Math.max(width,0) + 'px';
123
123
  }
124
124
 
125
125
  function initMirror() {
@@ -128,7 +128,7 @@
128
128
  mirrored = ta;
129
129
  mirror.className = options.className;
130
130
  mirror.id = options.id;
131
- maxHeight = parseInt($ta.css('maxHeight'), 10);
131
+ maxHeight = parseFloat($ta.css('maxHeight'));
132
132
 
133
133
  // mirror is a duplicate textarea located off-screen that
134
134
  // is automatically updated to contain the same text as the
@@ -138,7 +138,7 @@
138
138
  $.each(typographyStyles, function(i,val){
139
139
  styles[val] = $ta.css(val);
140
140
  });
141
-
141
+
142
142
  $(mirror).css(styles).attr('wrap', $ta.attr('wrap'));
143
143
 
144
144
  setWidth();
@@ -166,16 +166,17 @@
166
166
  }
167
167
 
168
168
  if (!ta.value && options.placeholder) {
169
- // If the textarea is empty, copy the placeholder text into
170
- // the mirror control and use that for sizing so that we
169
+ // If the textarea is empty, copy the placeholder text into
170
+ // the mirror control and use that for sizing so that we
171
171
  // don't end up with placeholder getting trimmed.
172
- mirror.value = ($ta.attr("placeholder") || '') + options.append;
172
+ mirror.value = ($ta.attr("placeholder") || '');
173
173
  } else {
174
- mirror.value = ta.value + options.append;
174
+ mirror.value = ta.value;
175
175
  }
176
176
 
177
+ mirror.value += options.append || '';
177
178
  mirror.style.overflowY = ta.style.overflowY;
178
- original = parseInt(ta.style.height,10);
179
+ original = parseFloat(ta.style.height);
179
180
 
180
181
  // Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
181
182
  mirror.scrollTop = 0;
@@ -199,9 +200,14 @@
199
200
 
200
201
  if (original !== height) {
201
202
  ta.style.height = height + 'px';
203
+
204
+ // Trigger a repaint for IE8 for when ta is nested 2 or more levels inside an inline-block
205
+ mirror.className = mirror.className;
206
+
202
207
  if (callback) {
203
208
  options.callback.call(ta,ta);
204
209
  }
210
+ $ta.trigger('autosize.resized');
205
211
  }
206
212
  }
207
213
 
@@ -269,4 +275,4 @@
269
275
  adjust();
270
276
  });
271
277
  };
272
- }(window.jQuery || window.$)); // jQuery or jQuery-like library, such as Zepto
278
+ }(jQuery || $)); // jQuery or jQuery-like library, such as Zepto
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autosize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.8
4
+ version: 1.18.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-25 00:00:00.000000000 Z
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.2.2
92
+ rubygems_version: 2.4.3
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: A plugin to enable automatic height for textarea elements.