Skip to content

Commit 5127118

Browse files
author
Duc Tri Le
committed
Merge pull request jquerytools#496 from ewheeler/dev
fix unexpected behavior when calling $('my_selector').tooltip() a second time on altered elements
2 parents 144c7c1 + d55f9bb commit 5127118

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/tooltip/tooltip.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,6 @@
331331

332332
// jQuery plugin implementation
333333
$.fn.tooltip = function(conf) {
334-
335-
// return existing instance
336-
var api = this.data("tooltip");
337-
if (api) { return api; }
338334

339335
conf = $.extend(true, {}, $.tools.tooltip.conf, conf);
340336

@@ -344,9 +340,12 @@
344340
}
345341

346342
// install tooltip for each entry in jQuery object
343+
// that is not an existing instance
347344
this.each(function() {
348-
api = new Tooltip($(this), conf);
349-
$(this).data("tooltip", api);
345+
if ( $(this).data("tooltip")===null){
346+
api = new Tooltip($(this), conf);
347+
$(this).data("tooltip", api);
348+
};
350349
});
351350

352351
return conf.api ? api: this;

0 commit comments

Comments
 (0)