tether-rails 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddb250f38f344b84e3d27862a8532aa42a87622e
4
- data.tar.gz: 2eb9af52801f54c97f1778abd413bc391987cf95
3
+ metadata.gz: 2d0f4d577c695c6a99c865a2496270187cbee130
4
+ data.tar.gz: 4c4e211919cc67ccf8ecbb7a1c6e24b0d6a7ba56
5
5
  SHA512:
6
- metadata.gz: 9a24b0ee1b645bdea205f23b4e571136afcdaf965c2992dd48f56bb4aca505463b847da382b1310838bf5e0c4163d8e2d0414cd920aa6022943628592d979f6f
7
- data.tar.gz: 17045483706d99cb68f7423940ca057d68f99d1ac922225bdf2ddae08bee30114fd6106f494c5a877ab190ac57286e433517ae115f500bc051e7fac4ea960ab9
6
+ metadata.gz: 6c3c563a8eb06f1255b43d4581168ba44b5df8a60002a2ff5fe843437a35fbfc2b7fbb143ef3c66bfc4dda369069a43c9667c6e62c0a25b761899a9ae6c23cee
7
+ data.tar.gz: bf138a2f33c239bc1a6fc3bffea493678dd6146a0bd02df1fc4accb05e7ec308fbf6bb679bc404f8ea708b4b4b18482316984e514858afe4ac59d579fba3e6db
@@ -1,3 +1,3 @@
1
1
  module TetherRails
2
- VERSION = '1.3.3'
2
+ VERSION = '1.4.0'
3
3
  end
@@ -1,4 +1,4 @@
1
- /*! tether 1.3.3 */
1
+ /*! tether 1.4.0 */
2
2
 
3
3
  (function(root, factory) {
4
4
  if (typeof define === 'function' && define.amd) {
@@ -108,7 +108,7 @@ var getOrigin = function getOrigin() {
108
108
  // are equivilant or not. We place an element at the top left of the page that will
109
109
  // get the same jitter, so we can cancel the two out.
110
110
  var node = zeroElement;
111
- if (!node) {
111
+ if (!node || !document.body.contains(node)) {
112
112
  node = document.createElement('div');
113
113
  node.setAttribute('data-tether-id', uniqueId());
114
114
  extend(node.style, {
@@ -179,7 +179,11 @@ function getOffsetParent(el) {
179
179
  return el.offsetParent || document.documentElement;
180
180
  }
181
181
 
182
+ var _scrollBarSize = null;
182
183
  function getScrollBarSize() {
184
+ if (_scrollBarSize) {
185
+ return _scrollBarSize;
186
+ }
183
187
  var inner = document.createElement('div');
184
188
  inner.style.width = '100%';
185
189
  inner.style.height = '200px';
@@ -212,7 +216,8 @@ function getScrollBarSize() {
212
216
 
213
217
  var width = widthContained - widthScroll;
214
218
 
215
- return { width: width, height: width };
219
+ _scrollBarSize = { width: width, height: width };
220
+ return _scrollBarSize;
216
221
  }
217
222
 
218
223
  function extend() {
@@ -1055,12 +1060,12 @@ var TetherClass = (function (_Evented) {
1055
1060
  var win = doc.defaultView;
1056
1061
 
1057
1062
  var scrollbarSize = undefined;
1058
- if (doc.body.scrollWidth > win.innerWidth) {
1063
+ if (win.innerHeight > doc.documentElement.clientHeight) {
1059
1064
  scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
1060
1065
  next.viewport.bottom -= scrollbarSize.height;
1061
1066
  }
1062
1067
 
1063
- if (doc.body.scrollHeight > win.innerHeight) {
1068
+ if (win.innerWidth > doc.documentElement.clientWidth) {
1064
1069
  scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
1065
1070
  next.viewport.right -= scrollbarSize.width;
1066
1071
  }
@@ -1181,7 +1186,16 @@ var TetherClass = (function (_Evented) {
1181
1186
  xPos = -_pos.right;
1182
1187
  }
1183
1188
 
1184
- css[transformKey] = 'translateX(' + Math.round(xPos) + 'px) translateY(' + Math.round(yPos) + 'px)';
1189
+ if (window.matchMedia) {
1190
+ // HubSpot/tether#207
1191
+ var retina = window.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches;
1192
+ if (!retina) {
1193
+ xPos = Math.round(xPos);
1194
+ yPos = Math.round(yPos);
1195
+ }
1196
+ }
1197
+
1198
+ css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
1185
1199
 
1186
1200
  if (transformKey !== 'msTransform') {
1187
1201
  // The Z transform will keep this in the GPU (faster, and prevents artifacts),
@@ -1233,20 +1247,24 @@ var TetherClass = (function (_Evented) {
1233
1247
  }
1234
1248
 
1235
1249
  if (!moved) {
1236
- var offsetParentIsBody = true;
1237
- var currentNode = this.element.parentNode;
1238
- while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
1239
- if (getComputedStyle(currentNode).position !== 'static') {
1240
- offsetParentIsBody = false;
1241
- break;
1242
- }
1250
+ if (this.options.bodyElement) {
1251
+ this.options.bodyElement.appendChild(this.element);
1252
+ } else {
1253
+ var offsetParentIsBody = true;
1254
+ var currentNode = this.element.parentNode;
1255
+ while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
1256
+ if (getComputedStyle(currentNode).position !== 'static') {
1257
+ offsetParentIsBody = false;
1258
+ break;
1259
+ }
1243
1260
 
1244
- currentNode = currentNode.parentNode;
1245
- }
1261
+ currentNode = currentNode.parentNode;
1262
+ }
1246
1263
 
1247
- if (!offsetParentIsBody) {
1248
- this.element.parentNode.removeChild(this.element);
1249
- this.element.ownerDocument.body.appendChild(this.element);
1264
+ if (!offsetParentIsBody) {
1265
+ this.element.parentNode.removeChild(this.element);
1266
+ this.element.ownerDocument.body.appendChild(this.element);
1267
+ }
1250
1268
  }
1251
1269
  }
1252
1270
 
@@ -1266,6 +1284,7 @@ var TetherClass = (function (_Evented) {
1266
1284
  if (write) {
1267
1285
  defer(function () {
1268
1286
  extend(_this8.element.style, writeCSS);
1287
+ _this8.trigger('repositioned');
1269
1288
  });
1270
1289
  }
1271
1290
  }
@@ -34,28 +34,32 @@
34
34
  top: 100%;
35
35
  left: 50%;
36
36
  margin-left: -16px;
37
- border-top-color: #000; }
37
+ border-top-color: #000;
38
+ border-bottom: 0; }
38
39
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-center .tether-content {
39
40
  margin-top: 16px; }
40
41
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-center .tether-content:before {
41
42
  bottom: 100%;
42
43
  left: 50%;
43
44
  margin-left: -16px;
44
- border-bottom-color: #000; }
45
+ border-bottom-color: #000;
46
+ border-top: 0; }
45
47
  .tether-element.tether-theme-arrows-dark.tether-element-attached-right.tether-element-attached-middle .tether-content {
46
48
  margin-right: 16px; }
47
49
  .tether-element.tether-theme-arrows-dark.tether-element-attached-right.tether-element-attached-middle .tether-content:before {
48
50
  left: 100%;
49
51
  top: 50%;
50
52
  margin-top: -16px;
51
- border-left-color: #000; }
53
+ border-left-color: #000;
54
+ border-right: 0; }
52
55
  .tether-element.tether-theme-arrows-dark.tether-element-attached-left.tether-element-attached-middle .tether-content {
53
56
  margin-left: 16px; }
54
57
  .tether-element.tether-theme-arrows-dark.tether-element-attached-left.tether-element-attached-middle .tether-content:before {
55
58
  right: 100%;
56
59
  top: 50%;
57
60
  margin-top: -16px;
58
- border-right-color: #000; }
61
+ border-right-color: #000;
62
+ border-left: 0; }
59
63
  .tether-element.tether-theme-arrows-dark.tether-element-attached-left.tether-target-attached-center .tether-content {
60
64
  left: -32px; }
61
65
  .tether-element.tether-theme-arrows-dark.tether-element-attached-right.tether-target-attached-center .tether-content {
@@ -65,70 +69,82 @@
65
69
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-middle .tether-content:before {
66
70
  bottom: 100%;
67
71
  left: 16px;
68
- border-bottom-color: #000; }
72
+ border-bottom-color: #000;
73
+ border-top: 0; }
69
74
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-middle .tether-content {
70
75
  margin-top: 16px; }
71
76
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-middle .tether-content:before {
72
77
  bottom: 100%;
73
78
  right: 16px;
74
- border-bottom-color: #000; }
79
+ border-bottom-color: #000;
80
+ border-top: 0; }
75
81
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-middle .tether-content {
76
82
  margin-bottom: 16px; }
77
83
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-middle .tether-content:before {
78
84
  top: 100%;
79
85
  left: 16px;
80
- border-top-color: #000; }
86
+ border-top-color: #000;
87
+ border-bottom: 0; }
81
88
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-middle .tether-content {
82
89
  margin-bottom: 16px; }
83
90
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-middle .tether-content:before {
84
91
  top: 100%;
85
92
  right: 16px;
86
- border-top-color: #000; }
93
+ border-top-color: #000;
94
+ border-bottom: 0; }
87
95
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-bottom .tether-content {
88
96
  margin-top: 16px; }
89
97
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-bottom .tether-content:before {
90
98
  bottom: 100%;
91
99
  left: 16px;
92
- border-bottom-color: #000; }
100
+ border-bottom-color: #000;
101
+ border-top: 0; }
93
102
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-bottom .tether-content {
94
103
  margin-top: 16px; }
95
104
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-bottom .tether-content:before {
96
105
  bottom: 100%;
97
106
  right: 16px;
98
- border-bottom-color: #000; }
107
+ border-bottom-color: #000;
108
+ border-top: 0; }
99
109
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-top .tether-content {
100
110
  margin-bottom: 16px; }
101
111
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-top .tether-content:before {
102
112
  top: 100%;
103
113
  left: 16px;
104
- border-top-color: #000; }
114
+ border-top-color: #000;
115
+ border-bottom: 0; }
105
116
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-top .tether-content {
106
117
  margin-bottom: 16px; }
107
118
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-top .tether-content:before {
108
119
  top: 100%;
109
120
  right: 16px;
110
- border-top-color: #000; }
121
+ border-top-color: #000;
122
+ border-bottom: 0; }
111
123
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-left .tether-content {
112
124
  margin-right: 16px; }
113
125
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-left .tether-content:before {
114
126
  top: 16px;
115
127
  left: 100%;
116
- border-left-color: #000; }
128
+ border-left-color: #000;
129
+ border-right: 0; }
117
130
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content {
118
131
  margin-left: 16px; }
119
132
  .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content:before {
120
133
  top: 16px;
121
134
  right: 100%;
122
- border-right-color: #000; }
135
+ border-right-color: #000;
136
+ border-left: 0; }
123
137
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-left .tether-content {
124
138
  margin-right: 16px; }
125
139
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-left .tether-content:before {
126
140
  bottom: 16px;
127
141
  left: 100%;
128
- border-left-color: #000; }
142
+ border-left-color: #000;
143
+ border-right: 0; }
129
144
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-right .tether-content {
130
145
  margin-left: 16px; }
131
146
  .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-right .tether-content:before {
132
147
  bottom: 16px;
133
148
  right: 100%;
134
- border-right-color: #000; }
149
+ border-right-color: #000;
150
+ border-left: 0; }
@@ -38,28 +38,32 @@
38
38
  top: 100%;
39
39
  left: 50%;
40
40
  margin-left: -16px;
41
- border-top-color: #fff; }
41
+ border-top-color: #fff;
42
+ border-bottom: 0; }
42
43
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-center .tether-content {
43
44
  margin-top: 16px; }
44
45
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-center .tether-content:before {
45
46
  bottom: 100%;
46
47
  left: 50%;
47
48
  margin-left: -16px;
48
- border-bottom-color: #fff; }
49
+ border-bottom-color: #fff;
50
+ border-top: 0; }
49
51
  .tether-element.tether-theme-arrows.tether-element-attached-right.tether-element-attached-middle .tether-content {
50
52
  margin-right: 16px; }
51
53
  .tether-element.tether-theme-arrows.tether-element-attached-right.tether-element-attached-middle .tether-content:before {
52
54
  left: 100%;
53
55
  top: 50%;
54
56
  margin-top: -16px;
55
- border-left-color: #fff; }
57
+ border-left-color: #fff;
58
+ border-right: 0; }
56
59
  .tether-element.tether-theme-arrows.tether-element-attached-left.tether-element-attached-middle .tether-content {
57
60
  margin-left: 16px; }
58
61
  .tether-element.tether-theme-arrows.tether-element-attached-left.tether-element-attached-middle .tether-content:before {
59
62
  right: 100%;
60
63
  top: 50%;
61
64
  margin-top: -16px;
62
- border-right-color: #fff; }
65
+ border-right-color: #fff;
66
+ border-left: 0; }
63
67
  .tether-element.tether-theme-arrows.tether-element-attached-left.tether-target-attached-center .tether-content {
64
68
  left: -32px; }
65
69
  .tether-element.tether-theme-arrows.tether-element-attached-right.tether-target-attached-center .tether-content {
@@ -69,70 +73,82 @@
69
73
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-left.tether-target-attached-middle .tether-content:before {
70
74
  bottom: 100%;
71
75
  left: 16px;
72
- border-bottom-color: #fff; }
76
+ border-bottom-color: #fff;
77
+ border-top: 0; }
73
78
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-middle .tether-content {
74
79
  margin-top: 16px; }
75
80
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-middle .tether-content:before {
76
81
  bottom: 100%;
77
82
  right: 16px;
78
- border-bottom-color: #fff; }
83
+ border-bottom-color: #fff;
84
+ border-top: 0; }
79
85
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-middle .tether-content {
80
86
  margin-bottom: 16px; }
81
87
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-middle .tether-content:before {
82
88
  top: 100%;
83
89
  left: 16px;
84
- border-top-color: #fff; }
90
+ border-top-color: #fff;
91
+ border-bottom: 0; }
85
92
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-middle .tether-content {
86
93
  margin-bottom: 16px; }
87
94
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-middle .tether-content:before {
88
95
  top: 100%;
89
96
  right: 16px;
90
- border-top-color: #fff; }
97
+ border-top-color: #fff;
98
+ border-bottom: 0; }
91
99
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-left.tether-target-attached-bottom .tether-content {
92
100
  margin-top: 16px; }
93
101
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-left.tether-target-attached-bottom .tether-content:before {
94
102
  bottom: 100%;
95
103
  left: 16px;
96
- border-bottom-color: #fff; }
104
+ border-bottom-color: #fff;
105
+ border-top: 0; }
97
106
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-bottom .tether-content {
98
107
  margin-top: 16px; }
99
108
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-bottom .tether-content:before {
100
109
  bottom: 100%;
101
110
  right: 16px;
102
- border-bottom-color: #fff; }
111
+ border-bottom-color: #fff;
112
+ border-top: 0; }
103
113
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-top .tether-content {
104
114
  margin-bottom: 16px; }
105
115
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-top .tether-content:before {
106
116
  top: 100%;
107
117
  left: 16px;
108
- border-top-color: #fff; }
118
+ border-top-color: #fff;
119
+ border-bottom: 0; }
109
120
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-top .tether-content {
110
121
  margin-bottom: 16px; }
111
122
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-top .tether-content:before {
112
123
  top: 100%;
113
124
  right: 16px;
114
- border-top-color: #fff; }
125
+ border-top-color: #fff;
126
+ border-bottom: 0; }
115
127
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-left .tether-content {
116
128
  margin-right: 16px; }
117
129
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-left .tether-content:before {
118
130
  top: 16px;
119
131
  left: 100%;
120
- border-left-color: #fff; }
132
+ border-left-color: #fff;
133
+ border-right: 0; }
121
134
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content {
122
135
  margin-left: 16px; }
123
136
  .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content:before {
124
137
  top: 16px;
125
138
  right: 100%;
126
- border-right-color: #fff; }
139
+ border-right-color: #fff;
140
+ border-left: 0; }
127
141
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-left .tether-content {
128
142
  margin-right: 16px; }
129
143
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-left .tether-content:before {
130
144
  bottom: 16px;
131
145
  left: 100%;
132
- border-left-color: #fff; }
146
+ border-left-color: #fff;
147
+ border-right: 0; }
133
148
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-right .tether-content {
134
149
  margin-left: 16px; }
135
150
  .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-right .tether-content:before {
136
151
  bottom: 16px;
137
152
  right: 100%;
138
- border-right-color: #fff; }
153
+ border-right-color: #fff;
154
+ border-left: 0; }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tether-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Gavin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2017-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -93,10 +93,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.5.1
96
+ rubygems_version: 2.6.8
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: tether-rails wraps the Tether JavaScript library so that it can easily be
100
100
  included in Rails.
101
101
  test_files: []
102
- has_rdoc: