Skip to content

Commit b16beee

Browse files
committed
dist build
1 parent bbdc2b9 commit b16beee

File tree

8 files changed

+172
-182
lines changed

8 files changed

+172
-182
lines changed
File renamed without changes.
File renamed without changes.

dist/js/tooltipster.bundle.js

Lines changed: 84 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ var defaults = {
8989
hasTransitions: transitionSupport(),
9090
IE: false,
9191
// don't set manually, it will be updated by a build task after the manifest
92-
semVer: '4.1.8',
92+
semVer: '4.2.0',
9393
window: win
9494
},
9595
core = function() {
@@ -432,9 +432,8 @@ $.Tooltipster = function(element, options) {
432432
this.__Content;
433433
// for the size tracker
434434
this.__contentBcr;
435-
// to disable the tooltip once the destruction has begun
435+
// to disable the tooltip after destruction
436436
this.__destroyed = false;
437-
this.__destroying = false;
438437
// we can't emit directly on the instance because if a method with the same
439438
// name as the event exists, it will be called by jQuery. Se we use a plain
440439
// object as emitter. This emitter is for internal use by plugins,
@@ -1436,10 +1435,11 @@ $.Tooltipster.prototype = {
14361435
*
14371436
* @param event
14381437
* @param callback
1438+
* @param force Set to true to override a potential refusal of the user's function
14391439
* @returns {self}
14401440
* @protected
14411441
*/
1442-
_close: function(event, callback) {
1442+
_close: function(event, callback, force) {
14431443

14441444
var self = this,
14451445
ok = true;
@@ -1452,8 +1452,8 @@ $.Tooltipster.prototype = {
14521452
}
14531453
});
14541454

1455-
// a destroying tooltip may not refuse to close
1456-
if (ok || self.__destroying) {
1455+
// a destroying tooltip (force == true) may not refuse to close
1456+
if (ok || force) {
14571457

14581458
// save the method custom callback and cancel any open method custom callbacks
14591459
if (callback) self.__callbacks.close.push(callback);
@@ -1648,10 +1648,10 @@ $.Tooltipster.prototype = {
16481648
},
16491649

16501650
/**
1651-
* Opens the tooltip right away
1651+
* Opens the tooltip right away.
16521652
*
16531653
* @param event
1654-
* @param callback
1654+
* @param callback Will be called when the opening animation is over
16551655
* @returns {self}
16561656
* @protected
16571657
*/
@@ -2495,94 +2495,90 @@ $.Tooltipster.prototype = {
24952495

24962496
if (!self.__destroyed) {
24972497

2498-
if (!self.__destroying) {
2499-
2500-
self.__destroying = true;
2498+
// no closing delay
2499+
self.option('animationDuration', 0)
2500+
// forced closing
2501+
._close(null, null, true)
2502+
// send event
2503+
._trigger('destroy');
2504+
2505+
self.__destroyed = true;
2506+
2507+
self._$origin
2508+
.removeData(self.__namespace)
2509+
// remove the open trigger listeners
2510+
.off('.'+ self.__namespace +'-triggerOpen');
2511+
2512+
// remove the touch listener
2513+
$(env.window.document.body).off('.' + self.__namespace +'-triggerOpen');
2514+
2515+
var ns = self._$origin.data('tooltipster-ns');
2516+
2517+
// if the origin has been removed from DOM, its data may
2518+
// well have been destroyed in the process and there would
2519+
// be nothing to clean up or restore
2520+
if (ns) {
25012521

2502-
self._close(null, function() {
2503-
2504-
self._trigger('destroy');
2505-
2506-
self.__destroying = false;
2507-
self.__destroyed = true;
2522+
// if there are no more tooltips on this element
2523+
if (ns.length === 1) {
25082524

2509-
self._$origin
2510-
.removeData(self.__namespace)
2511-
// remove the open trigger listeners
2512-
.off('.'+ self.__namespace +'-triggerOpen');
2513-
2514-
// remove the touch listener
2515-
$(env.window.document.body).off('.' + self.__namespace +'-triggerOpen');
2516-
2517-
var ns = self._$origin.data('tooltipster-ns');
2518-
2519-
// if the origin has been removed from DOM, its data may
2520-
// well have been destroyed in the process and there would
2521-
// be nothing to clean up or restore
2522-
if (ns) {
2525+
// optional restoration of a title attribute
2526+
var title = null;
2527+
if (self.__options.restoration == 'previous') {
2528+
title = self._$origin.data('tooltipster-initialTitle');
2529+
}
2530+
else if (self.__options.restoration == 'current') {
25232531

2524-
// if there are no more tooltips on this element
2525-
if (ns.length === 1) {
2526-
2527-
// optional restoration of a title attribute
2528-
var title = null;
2529-
if (self.__options.restoration == 'previous') {
2530-
title = self._$origin.data('tooltipster-initialTitle');
2531-
}
2532-
else if (self.__options.restoration == 'current') {
2533-
2534-
// old school technique to stringify when outerHTML is not supported
2535-
title = (typeof self.__Content == 'string') ?
2536-
self.__Content :
2537-
$('<div></div>').append(self.__Content).html();
2538-
}
2539-
2540-
if (title) {
2541-
self._$origin.attr('title', title);
2542-
}
2543-
2544-
// final cleaning
2545-
2546-
self._$origin.removeClass('tooltipstered');
2547-
2548-
self._$origin
2549-
.removeData('tooltipster-ns')
2550-
.removeData('tooltipster-initialTitle');
2551-
}
2552-
else {
2553-
// remove the instance namespace from the list of namespaces of
2554-
// tooltips present on the element
2555-
ns = $.grep(ns, function(el, i) {
2556-
return el !== self.__namespace;
2557-
});
2558-
self._$origin.data('tooltipster-ns', ns);
2559-
}
2532+
// old school technique to stringify when outerHTML is not supported
2533+
title = (typeof self.__Content == 'string') ?
2534+
self.__Content :
2535+
$('<div></div>').append(self.__Content).html();
25602536
}
25612537

2562-
// last event
2563-
self._trigger('destroyed');
2538+
if (title) {
2539+
self._$origin.attr('title', title);
2540+
}
25642541

2565-
// unbind private and public event listeners
2566-
self._off();
2567-
self.off();
2542+
// final cleaning
25682543

2569-
// remove external references, just in case
2570-
self.__Content = null;
2571-
self.__$emitterPrivate = null;
2572-
self.__$emitterPublic = null;
2573-
self.__options.parent = null;
2574-
self._$origin = null;
2575-
self._$tooltip = null;
2544+
self._$origin.removeClass('tooltipstered');
25762545

2577-
// make sure the object is no longer referenced in there to prevent
2578-
// memory leaks
2579-
$.tooltipster.__instancesLatestArr = $.grep($.tooltipster.__instancesLatestArr, function(el, i) {
2580-
return self !== el;
2546+
self._$origin
2547+
.removeData('tooltipster-ns')
2548+
.removeData('tooltipster-initialTitle');
2549+
}
2550+
else {
2551+
// remove the instance namespace from the list of namespaces of
2552+
// tooltips present on the element
2553+
ns = $.grep(ns, function(el, i) {
2554+
return el !== self.__namespace;
25812555
});
2582-
2583-
clearInterval(self.__garbageCollector);
2584-
});
2556+
self._$origin.data('tooltipster-ns', ns);
2557+
}
25852558
}
2559+
2560+
// last event
2561+
self._trigger('destroyed');
2562+
2563+
// unbind private and public event listeners
2564+
self._off();
2565+
self.off();
2566+
2567+
// remove external references, just in case
2568+
self.__Content = null;
2569+
self.__$emitterPrivate = null;
2570+
self.__$emitterPublic = null;
2571+
self.__options.parent = null;
2572+
self._$origin = null;
2573+
self._$tooltip = null;
2574+
2575+
// make sure the object is no longer referenced in there to prevent
2576+
// memory leaks
2577+
$.tooltipster.__instancesLatestArr = $.grep($.tooltipster.__instancesLatestArr, function(el, i) {
2578+
return self !== el;
2579+
});
2580+
2581+
clearInterval(self.__garbageCollector);
25862582
}
25872583
else {
25882584
self.__destroyError();
@@ -2734,7 +2730,7 @@ $.Tooltipster.prototype = {
27342730
*/
27352731
open: function(callback) {
27362732

2737-
if (!this.__destroyed && !this.__destroying) {
2733+
if (!this.__destroyed) {
27382734
this._open(null, callback);
27392735
}
27402736
else {
@@ -2862,7 +2858,6 @@ $.Tooltipster.prototype = {
28622858

28632859
return {
28642860
destroyed: this.__destroyed,
2865-
destroying: this.__destroying,
28662861
enabled: this.__enabled,
28672862
open: this.__state !== 'closed',
28682863
state: this.__state
@@ -3324,7 +3319,7 @@ function transitionSupport() {
33243319

33253320
// we'll return jQuery for plugins not to have to declare it as a dependency,
33263321
// but it's done by a build task since it should be included only once at the
3327-
// end when we concatenate the core file with a plugin
3322+
// end when we concatenate the main file with a plugin
33283323
// sideTip is Tooltipster's default plugin.
33293324
// This file will be UMDified by a build task.
33303325

dist/js/tooltipster.bundle.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/tooltipster.core.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)