Bootstrap: tooltip/popover 'destroy' needs event

Created on 19 Jan 2015  Â·  8Comments  Â·  Source: twbs/bootstrap

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.

feature js

Most helpful comment

@fat but we need it for Bootstrap 3 also. :disappointed:

All 8 comments

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leomao10 picture leomao10  Â·  3Comments

knownasilya picture knownasilya  Â·  3Comments

iklementiev picture iklementiev  Â·  3Comments

MrCsabaToth picture MrCsabaToth  Â·  3Comments

eddywashere picture eddywashere  Â·  3Comments