@@ -17,9 +17,9 @@ var defaults = {
17
17
IEmin : 6 ,
18
18
interactive : false ,
19
19
multiple : false ,
20
- // must be 'body' for now, or an element positioned at (0, 0)
20
+ // must be 'body' for now (default) , or an element positioned at (0, 0)
21
21
// in the document, typically like the very top views of an app.
22
- parent : 'body' ,
22
+ parent : null ,
23
23
plugins : [ 'sideTip' ] ,
24
24
repositionOnScroll : false ,
25
25
restoration : 'none' ,
@@ -546,7 +546,7 @@ $.Tooltipster.prototype = {
546
546
547
547
// to detect swiping
548
548
if ( env . hasTouchCapability ) {
549
- $ ( ' body' ) . on ( 'touchmove.' + self . __namespace + '-triggerOpen' , function ( event ) {
549
+ $ ( env . window . document . body ) . on ( 'touchmove.' + self . __namespace + '-triggerOpen' , function ( event ) {
550
550
self . _touchRecordEvent ( event ) ;
551
551
} ) ;
552
552
}
@@ -941,7 +941,10 @@ $.Tooltipster.prototype = {
941
941
}
942
942
943
943
// determine the future parent
944
- if ( typeof this . __options . parent == 'string' ) {
944
+ if ( this . __options . parent === null ) {
945
+ this . __options . parent = $ ( env . window . document . body ) ;
946
+ }
947
+ else if ( typeof this . __options . parent == 'string' ) {
945
948
this . __options . parent = $ ( this . __options . parent ) ;
946
949
}
947
950
@@ -1519,7 +1522,7 @@ $.Tooltipster.prototype = {
1519
1522
// clear the array to prevent memory leaks
1520
1523
self . __$originParents = null ;
1521
1524
1522
- $ ( ' body' ) . off ( '.' + self . __namespace + '-triggerClose' ) ;
1525
+ $ ( env . window . document . body ) . off ( '.' + self . __namespace + '-triggerClose' ) ;
1523
1526
1524
1527
self . _$origin . off ( '.' + self . __namespace + '-triggerClose' ) ;
1525
1528
@@ -1971,7 +1974,7 @@ $.Tooltipster.prototype = {
1971
1974
eventNames += 'touchend.' + self . __namespace + '-triggerClose' ;
1972
1975
}
1973
1976
1974
- $ ( ' body' ) . on ( eventNames , function ( event ) {
1977
+ $ ( env . window . document . body ) . on ( eventNames , function ( event ) {
1975
1978
1976
1979
if ( self . _touchIsMeaningfulEvent ( event ) ) {
1977
1980
@@ -1986,7 +1989,7 @@ $.Tooltipster.prototype = {
1986
1989
// needed to detect and ignore swiping
1987
1990
if ( self . __options . triggerClose . tap && env . hasTouchCapability ) {
1988
1991
1989
- $ ( ' body' ) . on ( 'touchstart.' + self . __namespace + '-triggerClose' , function ( event ) {
1992
+ $ ( env . window . document . body ) . on ( 'touchstart.' + self . __namespace + '-triggerClose' , function ( event ) {
1990
1993
self . _touchRecordEvent ( event ) ;
1991
1994
} ) ;
1992
1995
}
@@ -2485,7 +2488,7 @@ $.Tooltipster.prototype = {
2485
2488
. off ( '.' + self . __namespace + '-triggerOpen' ) ;
2486
2489
2487
2490
// remove the touch listener
2488
- $ ( ' body' ) . off ( '.' + self . __namespace + '-triggerOpen' ) ;
2491
+ $ ( env . window . document . body ) . off ( '.' + self . __namespace + '-triggerOpen' ) ;
2489
2492
2490
2493
var ns = self . _$origin . data ( 'tooltipster-ns' ) ;
2491
2494
@@ -3070,7 +3073,7 @@ Ruler.prototype = {
3070
3073
3071
3074
this . $container = $ ( '<div class="tooltipster-ruler"></div>' )
3072
3075
. append ( this . __$tooltip )
3073
- . appendTo ( ' body' ) ;
3076
+ . appendTo ( env . window . document . body ) ;
3074
3077
} ,
3075
3078
3076
3079
/**
0 commit comments