The tooltip/popover 'destroy' method is implicitly async because it calls hide first, and so a sequence like $(selector).popover('destroy').popover({ ... }) does not reliably work.
I suggest that, like 'show' and 'hide', 'destroy' be given events 'destroy.bs.popover' and 'destroyed.bs.popover', so that a caller can know for sure that a 'destroy' is finished and can do whatever they need to do to the elements which depends on the tooltip/popover being cleared out.
Seconded, Chain All the things!
Agreed, chaining would be very useful.
+1. Killed some hours while working with tooltips.
Is this a bug or a feature @cvrebert? If the latter, shall we punt to v4?
I think the real problem here is that "destroy" was conflated with "hide", making it async… which is probably not the best.
At any rate, we are going to revisit teardown methods in v4, thanks for the input!
@fat but we need it for Bootstrap 3 also. :disappointed:
@fat was it fixed in bootstrap v3.4.0? seems like not...
Expected behavior:
$('#destroy-confirmation')
.tooltip({placement: 'top'})
.tooltip('destroy');
$('#destroy-confirmation-re')
.tooltip({placement: 'top'})
.tooltip('destroy')
.tooltip({placement: 'right'});
1st case - doesn't show tooltip after destroy
2nd case - show on the right since it was re-initialized
@seyfer did you find some workaround?
Most helpful comment
@fat but we need it for Bootstrap 3 also. :disappointed: