@@ -100,7 +100,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
100
100
'title="' + startSym + 'tt_title' + endSym + '" ' +
101
101
'content="' + startSym + 'tt_content' + endSym + '" ' +
102
102
'placement="' + startSym + 'tt_placement' + endSym + '" ' +
103
- 'animation="tt_animation() " ' +
103
+ 'animation="tt_animation" ' +
104
104
'is-open="tt_isOpen"' +
105
105
'>' +
106
106
'</' + directiveName + '-popup>' ;
@@ -112,7 +112,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
112
112
var tooltip = $compile ( template ) ( scope ) ;
113
113
var transitionTimeout ;
114
114
var popupTimeout ;
115
- var $body ;
115
+ var $body = $document . find ( 'body' ) ;
116
116
var appendToBody = angular . isDefined ( options . appendToBody ) ? options . appendToBody : false ;
117
117
var triggers = getTriggers ( undefined ) ;
118
118
var hasRegisteredTriggers = false ;
@@ -172,7 +172,6 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
172
172
// Now we add it to the DOM because need some info about it. But it's not
173
173
// visible yet anyway.
174
174
if ( appendToBody ) {
175
- $body = $body || $document . find ( 'body' ) ;
176
175
$body . append ( tooltip ) ;
177
176
} else {
178
177
element . after ( tooltip ) ;
@@ -235,8 +234,10 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
235
234
// And now we remove it from the DOM. However, if we have animation, we
236
235
// need to wait for it to expire beforehand.
237
236
// FIXME: this is a placeholder for a port of the transitions library.
238
- if ( angular . isDefined ( scope . tt_animation ) && scope . tt_animation ( ) ) {
239
- transitionTimeout = $timeout ( function ( ) { tooltip . remove ( ) ; } , 500 ) ;
237
+ if ( scope . tt_animation ) {
238
+ transitionTimeout = $timeout ( function ( ) {
239
+ tooltip . remove ( ) ;
240
+ } , 500 ) ;
240
241
} else {
241
242
tooltip . remove ( ) ;
242
243
}
@@ -263,8 +264,8 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
263
264
scope . tt_placement = angular . isDefined ( val ) ? val : options . placement ;
264
265
} ) ;
265
266
266
- attrs . $observe ( prefix + 'Animation' , function ( val ) {
267
- scope . tt_animation = angular . isDefined ( val ) ? $parse ( val ) : function ( ) { return options . animation ; } ;
267
+ attrs . $observe ( prefix + 'Animation' , function ( val ) {
268
+ scope . tt_animation = angular . isDefined ( val ) ? ! ! val : options . animation ;
268
269
} ) ;
269
270
270
271
attrs . $observe ( prefix + 'PopupDelay' , function ( val ) {
@@ -308,11 +309,11 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
308
309
309
310
// Make sure tooltip is destroyed and removed.
310
311
scope . $on ( '$destroy' , function onDestroyTooltip ( ) {
311
- if ( scope . tt_isOpen ) {
312
- hide ( ) ;
313
- } else {
314
- tooltip . remove ( ) ;
315
- }
312
+ $timeout . cancel ( popupTimeout ) ;
313
+ tooltip . remove ( ) ;
314
+ tooltip . unbind ( ) ;
315
+ tooltip = null ;
316
+ $body = null ;
316
317
} ) ;
317
318
}
318
319
} ;
0 commit comments