1
- /*! tether 1.0.3 */
1
+ /*! tether 1.1.0 */
2
2
3
3
( function ( root , factory ) {
4
4
if ( typeof define === 'function' && define . amd ) {
@@ -182,7 +182,7 @@ function getScrollBarSize() {
182
182
}
183
183
184
184
function extend ( ) {
185
- var out = arguments [ 0 ] === undefined ? { } : arguments [ 0 ] ;
185
+ var out = arguments . length <= 0 || arguments [ 0 ] === undefined ? { } : arguments [ 0 ] ;
186
186
187
187
var args = [ ] ;
188
188
@@ -285,7 +285,7 @@ var Evented = (function () {
285
285
_createClass ( Evented , [ {
286
286
key : 'on' ,
287
287
value : function on ( event , handler , ctx ) {
288
- var once = arguments [ 3 ] === undefined ? false : arguments [ 3 ] ;
288
+ var once = arguments . length <= 3 || arguments [ 3 ] === undefined ? false : arguments [ 3 ] ;
289
289
290
290
if ( typeof this . bindings === 'undefined' ) {
291
291
this . bindings = { } ;
@@ -397,7 +397,7 @@ var flush = _TetherBase$Utils.flush;
397
397
var getScrollBarSize = _TetherBase$Utils . getScrollBarSize ;
398
398
399
399
function within ( a , b ) {
400
- var diff = arguments [ 2 ] === undefined ? 1 : arguments [ 2 ] ;
400
+ var diff = arguments . length <= 2 || arguments [ 2 ] === undefined ? 1 : arguments [ 2 ] ;
401
401
402
402
return a + diff >= b && b >= a - diff ;
403
403
}
@@ -590,7 +590,7 @@ var TetherClass = (function () {
590
590
_createClass ( TetherClass , [ {
591
591
key : 'getClass' ,
592
592
value : function getClass ( ) {
593
- var key = arguments [ 0 ] === undefined ? '' : arguments [ 0 ] ;
593
+ var key = arguments . length <= 0 || arguments [ 0 ] === undefined ? '' : arguments [ 0 ] ;
594
594
var classes = this . options . classes ;
595
595
596
596
if ( typeof classes !== 'undefined' && classes [ key ] ) {
@@ -606,7 +606,7 @@ var TetherClass = (function () {
606
606
value : function setOptions ( options ) {
607
607
var _this2 = this ;
608
608
609
- var pos = arguments [ 1 ] === undefined ? true : arguments [ 1 ] ;
609
+ var pos = arguments . length <= 1 || arguments [ 1 ] === undefined ? true : arguments [ 1 ] ;
610
610
611
611
var defaults = {
612
612
offset : '0 0' ,
@@ -788,7 +788,7 @@ var TetherClass = (function () {
788
788
} , {
789
789
key : 'enable' ,
790
790
value : function enable ( ) {
791
- var pos = arguments [ 0 ] === undefined ? true : arguments [ 0 ] ;
791
+ var pos = arguments . length <= 0 || arguments [ 0 ] === undefined ? true : arguments [ 0 ] ;
792
792
793
793
if ( ! ( this . options . addTargetClasses === false ) ) {
794
794
addClass ( this . target , this . getClass ( 'enabled' ) ) ;
@@ -887,7 +887,7 @@ var TetherClass = (function () {
887
887
value : function position ( ) {
888
888
var _this5 = this ;
889
889
890
- var flushChanges = arguments [ 0 ] === undefined ? true : arguments [ 0 ] ;
890
+ var flushChanges = arguments . length <= 0 || arguments [ 0 ] === undefined ? true : arguments [ 0 ] ;
891
891
892
892
// flushChanges commits the changes immediately, leave true unless you are positioning multiple
893
893
// tethers (in which case call Tether.Utils.flush yourself when you're done)
@@ -1165,9 +1165,22 @@ var TetherClass = (function () {
1165
1165
transcribe ( { top : true , left : true } , pos . page ) ;
1166
1166
}
1167
1167
1168
- if ( ! moved && this . element . parentNode . tagName !== 'BODY' ) {
1169
- this . element . parentNode . removeChild ( this . element ) ;
1170
- document . body . appendChild ( this . element ) ;
1168
+ if ( ! moved ) {
1169
+ var offsetParentIsBody = true ;
1170
+ var currentNode = this . element . parentNode ;
1171
+ while ( currentNode && currentNode . tagName !== 'BODY' ) {
1172
+ if ( getComputedStyle ( currentNode ) . position !== 'static' ) {
1173
+ offsetParentIsBody = false ;
1174
+ break ;
1175
+ }
1176
+
1177
+ currentNode = currentNode . parentNode ;
1178
+ }
1179
+
1180
+ if ( ! offsetParentIsBody ) {
1181
+ this . element . parentNode . removeChild ( this . element ) ;
1182
+ document . body . appendChild ( this . element ) ;
1183
+ }
1171
1184
}
1172
1185
1173
1186
// Any css change will trigger a repaint, so let's avoid one if nothing changed
0 commit comments