autosize-rails 1.18.15 → 1.18.17

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: b3386a162901d494796135d75b810a8606f324bd
4
- data.tar.gz: dbaaf8645821f067c4b91f27afebebb17cc5dd8a
3
+ metadata.gz: 87ffef5bee0d42f74a56292930a5afbe60b8048a
4
+ data.tar.gz: 31d4234fc007c3de4b77e802ccc5c2cf4a1d22f4
5
5
  SHA512:
6
- metadata.gz: b2861edbedde17e17b6f7330d325966d242755c2e765300b36e8b8f65446a6920d321042c915906fc4fa94d25423c4e797c21a1cf44d8aae1a3f04c98e1f1904
7
- data.tar.gz: a2649322701b4cfb1ce5ab77f9c103d03647f2c0eb87a5a024d1efcda8a3ea02a23d0ab6297bb6333f276db570c043ded2a7e868c22873fce200e4e6f19735ce
6
+ metadata.gz: e91f4252c25d694cdcfc5b322e34f624ba1fc23789d52467de7472e2801d5dac9fb44ce25fb1a932ea7ccb609c2864de2a81c621414ecd166a279428345f2626
7
+ data.tar.gz: 36b30cfe5a3aadc226838c35c7384965f1a529fe112548d5f68f4f0511a4499426dacd3b8cd528944f72b6b25d79ad4cd1b56cf41033e7a0ae569d9b053a965d
@@ -1,5 +1,5 @@
1
1
  module Autosize
2
2
  module Rails
3
- VERSION = "1.18.15"
3
+ VERSION = "1.18.17"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Autosize 1.18.15
2
+ Autosize 1.18.17
3
3
  license: MIT
4
4
  http://www.jacklmoore.com/autosize
5
5
  */
@@ -98,23 +98,18 @@
98
98
  $ta.css('resize', 'horizontal');
99
99
  }
100
100
 
101
- // The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
102
- // window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower.
101
+ // getComputedStyle is preferred here because it preserves sub-pixel values, while jQuery's .width() rounds to an integer.
103
102
  function setWidth() {
104
103
  var width;
105
- var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;
104
+ var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : null;
106
105
 
107
106
  if (style) {
108
-
109
- width = ta.getBoundingClientRect().width;
110
-
111
- if (width === 0 || typeof width !== 'number') {
112
- width = parseFloat(style.width);
107
+ width = parseFloat(style.width);
108
+ if (style.boxSizing === 'border-box' || style.webkitBoxSizing === 'border-box' || style.mozBoxSizing === 'border-box') {
109
+ $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
110
+ width -= parseFloat(style[val]);
111
+ });
113
112
  }
114
-
115
- $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
116
- width -= parseFloat(style[val]);
117
- });
118
113
  } else {
119
114
  width = $ta.width();
120
115
  }
@@ -157,7 +152,7 @@
157
152
  // Using mainly bare JS in this function because it is going
158
153
  // to fire very often while typing, and needs to very efficient.
159
154
  function adjust() {
160
- var height, original;
155
+ var height, originalHeight;
161
156
 
162
157
  if (mirrored !== ta) {
163
158
  initMirror();
@@ -176,7 +171,7 @@
176
171
 
177
172
  mirror.value += options.append || '';
178
173
  mirror.style.overflowY = ta.style.overflowY;
179
- original = parseFloat(ta.style.height);
174
+ originalHeight = parseFloat(ta.style.height) || 0;
180
175
 
181
176
  // Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
182
177
  mirror.scrollTop = 0;
@@ -198,7 +193,7 @@
198
193
 
199
194
  height += boxOffset;
200
195
 
201
- if (original !== height) {
196
+ if (Math.abs(originalHeight - height) > 1/100) {
202
197
  ta.style.height = height + 'px';
203
198
 
204
199
  // Trigger a repaint for IE8 for when ta is nested 2 or more levels inside an inline-block
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autosize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.15
4
+ version: 1.18.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Thompson