1- /*! tether 1.0.3 */
1+ /*! tether 1.1.0 */
22
33( function ( root , factory ) {
44 if ( typeof define === 'function' && define . amd ) {
@@ -182,7 +182,7 @@ function getScrollBarSize() {
182182}
183183
184184function extend ( ) {
185- var out = arguments [ 0 ] === undefined ? { } : arguments [ 0 ] ;
185+ var out = arguments . length <= 0 || arguments [ 0 ] === undefined ? { } : arguments [ 0 ] ;
186186
187187 var args = [ ] ;
188188
@@ -285,7 +285,7 @@ var Evented = (function () {
285285 _createClass ( Evented , [ {
286286 key : 'on' ,
287287 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 ] ;
289289
290290 if ( typeof this . bindings === 'undefined' ) {
291291 this . bindings = { } ;
@@ -397,7 +397,7 @@ var flush = _TetherBase$Utils.flush;
397397var getScrollBarSize = _TetherBase$Utils . getScrollBarSize ;
398398
399399function within ( a , b ) {
400- var diff = arguments [ 2 ] === undefined ? 1 : arguments [ 2 ] ;
400+ var diff = arguments . length <= 2 || arguments [ 2 ] === undefined ? 1 : arguments [ 2 ] ;
401401
402402 return a + diff >= b && b >= a - diff ;
403403}
@@ -590,7 +590,7 @@ var TetherClass = (function () {
590590 _createClass ( TetherClass , [ {
591591 key : 'getClass' ,
592592 value : function getClass ( ) {
593- var key = arguments [ 0 ] === undefined ? '' : arguments [ 0 ] ;
593+ var key = arguments . length <= 0 || arguments [ 0 ] === undefined ? '' : arguments [ 0 ] ;
594594 var classes = this . options . classes ;
595595
596596 if ( typeof classes !== 'undefined' && classes [ key ] ) {
@@ -606,7 +606,7 @@ var TetherClass = (function () {
606606 value : function setOptions ( options ) {
607607 var _this2 = this ;
608608
609- var pos = arguments [ 1 ] === undefined ? true : arguments [ 1 ] ;
609+ var pos = arguments . length <= 1 || arguments [ 1 ] === undefined ? true : arguments [ 1 ] ;
610610
611611 var defaults = {
612612 offset : '0 0' ,
@@ -788,7 +788,7 @@ var TetherClass = (function () {
788788 } , {
789789 key : 'enable' ,
790790 value : function enable ( ) {
791- var pos = arguments [ 0 ] === undefined ? true : arguments [ 0 ] ;
791+ var pos = arguments . length <= 0 || arguments [ 0 ] === undefined ? true : arguments [ 0 ] ;
792792
793793 if ( ! ( this . options . addTargetClasses === false ) ) {
794794 addClass ( this . target , this . getClass ( 'enabled' ) ) ;
@@ -887,7 +887,7 @@ var TetherClass = (function () {
887887 value : function position ( ) {
888888 var _this5 = this ;
889889
890- var flushChanges = arguments [ 0 ] === undefined ? true : arguments [ 0 ] ;
890+ var flushChanges = arguments . length <= 0 || arguments [ 0 ] === undefined ? true : arguments [ 0 ] ;
891891
892892 // flushChanges commits the changes immediately, leave true unless you are positioning multiple
893893 // tethers (in which case call Tether.Utils.flush yourself when you're done)
@@ -1165,9 +1165,22 @@ var TetherClass = (function () {
11651165 transcribe ( { top : true , left : true } , pos . page ) ;
11661166 }
11671167
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+ }
11711184 }
11721185
11731186 // Any css change will trigger a repaint, so let's avoid one if nothing changed
0 commit comments