()
| 272 | self.state('disappearing'); |
| 273 | |
| 274 | var finish = function() { |
| 275 | |
| 276 | // stop the tracker |
| 277 | clearInterval(self.tracker); |
| 278 | |
| 279 | // a beforeClose option has been asked several times but would |
| 280 | // probably useless since the content element is still accessible |
| 281 | // via ::content(), and because people can always use listeners |
| 282 | // inside their content to track what's going on. For the sake of |
| 283 | // simplicity, this has been denied. Bur for the rare people who |
| 284 | // really need the option (for old browsers or for the case where |
| 285 | // detaching the content is actually destructive, for file or |
| 286 | // password inputs for example), this event will do the work. |
| 287 | self._trigger({ |
| 288 | type: 'beforeClose', |
| 289 | event: event |
| 290 | }); |
| 291 | |
| 292 | // detach our content object first, so the next jQuery's remove() |
| 293 | // call does not unbind its event handlers |
| 294 | if (typeof self.Content == 'object' && self.Content !== null) { |
| 295 | self.Content.detach(); |
| 296 | } |
| 297 | |
| 298 | self.$tooltip.remove(); |
| 299 | self.$tooltip = null; |
| 300 | |
| 301 | // unbind orientationchange, scroll and resize listeners |
| 302 | $(window).off('.'+ self.namespace); |
| 303 | |
| 304 | // unbind scroll listeners |
| 305 | self.$originParents.each(function(i, el){ |
| 306 | $(el).off('scroll.'+ self.namespace); |
| 307 | }); |
| 308 | // clear the array to prevent memory leaks |
| 309 | self.$originParents = null; |
| 310 | |
| 311 | // unbind any auto-closing click/touch listeners |
| 312 | $('body').off('.'+ self.namespace +'-autoClose'); |
| 313 | |
| 314 | // unbind any auto-closing hover listeners |
| 315 | self.$el.off('.'+ self.namespace +'-autoClose'); |
| 316 | |
| 317 | self.state('closed'); |
| 318 | |
| 319 | // trigger event |
| 320 | self._trigger({ |
| 321 | type: 'after', |
| 322 | event: event |
| 323 | }); |
| 324 | |
| 325 | // call our constructor custom callback function |
| 326 | if (self.options.functionAfter) { |
| 327 | self.options.functionAfter.call(self, self, { |
| 328 | event: event, |
| 329 | origin: self.$el[0] |
| 330 | }); |
| 331 | } |
no test coverage detected