Skip to content

Commit

Permalink
Merge pull request #71 from louisameline/destroyFix
Browse files Browse the repository at this point in the history
Remove the delegated icon in destroy method
  • Loading branch information
calebjacob committed Oct 30, 2013
2 parents c86a3f4 + 8186797 commit c2229f3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions js/jquery.tooltipster.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

// if this is a touch device, add some touch events to launch the tooltip
if ((object.options.touchDevices) && (touchDevice) && ((object.options.trigger == 'click') || (object.options.trigger == 'hover'))) {
$this.bind('touchstart', function(element, options) {
$this.on('touchstart.tooltipster', function(element, options) {
object.showTooltip();
});
}
Expand Down Expand Up @@ -910,8 +910,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
break;

case 'destroy':

$(this).data('plugin_tooltipster').hideTooltip();
$(this).data('plugin_tooltipster', '').attr('title', $t.data('tooltipsterContent')).data('tooltipsterContent', '').data('plugin_tooltipster', '').off('mouseenter.tooltipster mouseleave.tooltipster click.tooltipster').unbind('touchstart');

var icon = $(this).data('tooltipsterIcon');
if(icon) icon.remove();

$(this)
.attr('title', $t.data('tooltipsterContent'))
.removeData('plugin_tooltipster')
.removeData('tooltipsterContent')
.removeData('tooltipsterIcon')
.off('.tooltipster');
break;

case 'elementicon':
Expand Down

0 comments on commit c2229f3

Please sign in to comment.