Skip to content

Commit 69d5269

Browse files
committed
Issue 157. Tooltip element is no longer assigned multiple event listeners
1 parent 628b78d commit 69d5269

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/tooltip/tooltip.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -226,20 +226,25 @@
226226
// tooltip events
227227
var event = conf.events.tooltip.split(/,\s*/);
228228

229-
tip.bind(event[0], function() {
230-
clearTimeout(timer);
231-
clearTimeout(pretimer);
232-
});
233-
234-
if (event[1] && !trigger.is("input:not(:checkbox, :radio), textarea")) {
235-
tip.bind(event[1], function(e) {
236-
237-
// being moved to the trigger element
238-
if (e.relatedTarget != trigger[0]) {
239-
trigger.trigger(evt[1].split(" ")[0]);
240-
}
241-
});
242-
}
229+
if (!tip.data("__set")) {
230+
231+
tip.bind(event[0], function() {
232+
clearTimeout(timer);
233+
clearTimeout(pretimer);
234+
});
235+
236+
if (event[1] && !trigger.is("input:not(:checkbox, :radio), textarea")) {
237+
tip.bind(event[1], function(e) {
238+
239+
// being moved to the trigger element
240+
if (e.relatedTarget != trigger[0]) {
241+
trigger.trigger(evt[1].split(" ")[0]);
242+
}
243+
});
244+
}
245+
246+
tip.data("__set", true);
247+
}
243248

244249
return self;
245250
},

0 commit comments

Comments
 (0)