@@ -100,7 +100,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
100100 'title="' + startSym + 'tt_title' + endSym + '" ' +
101101 'content="' + startSym + 'tt_content' + endSym + '" ' +
102102 'placement="' + startSym + 'tt_placement' + endSym + '" ' +
103- 'animation="tt_animation() " ' +
103+ 'animation="tt_animation" ' +
104104 'is-open="tt_isOpen"' +
105105 '>' +
106106 '</' + directiveName + '-popup>' ;
@@ -112,7 +112,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
112112 var tooltip = $compile ( template ) ( scope ) ;
113113 var transitionTimeout ;
114114 var popupTimeout ;
115- var $body ;
115+ var $body = $document . find ( 'body' ) ;
116116 var appendToBody = angular . isDefined ( options . appendToBody ) ? options . appendToBody : false ;
117117 var triggers = getTriggers ( undefined ) ;
118118 var hasRegisteredTriggers = false ;
@@ -172,7 +172,6 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
172172 // Now we add it to the DOM because need some info about it. But it's not
173173 // visible yet anyway.
174174 if ( appendToBody ) {
175- $body = $body || $document . find ( 'body' ) ;
176175 $body . append ( tooltip ) ;
177176 } else {
178177 element . after ( tooltip ) ;
@@ -235,8 +234,10 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
235234 // And now we remove it from the DOM. However, if we have animation, we
236235 // need to wait for it to expire beforehand.
237236 // 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 ) ;
240241 } else {
241242 tooltip . remove ( ) ;
242243 }
@@ -263,8 +264,8 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
263264 scope . tt_placement = angular . isDefined ( val ) ? val : options . placement ;
264265 } ) ;
265266
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 ;
268269 } ) ;
269270
270271 attrs . $observe ( prefix + 'PopupDelay' , function ( val ) {
@@ -308,11 +309,11 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
308309
309310 // Make sure tooltip is destroyed and removed.
310311 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 ;
316317 } ) ;
317318 }
318319 } ;
0 commit comments