Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Destroy Ensure The Tooltip Is Unloaded #13

Open
nadnoslen opened this issue Dec 10, 2018 · 1 comment
Open

On Destroy Ensure The Tooltip Is Unloaded #13

nadnoslen opened this issue Dec 10, 2018 · 1 comment

Comments

@nadnoslen
Copy link
Member

From a usage I had:

Uncaught TypeError: Cannot read property 'off' of null
    at bootstrap.js:1735
    at HTMLDivElement.complete (bootstrap.js:1581)
    at HTMLDivElement.fn (jquery.js:4955)
    at HTMLDivElement.handle (bootstrap.js:72)
    at HTMLDivElement.dispatch (jquery.js:5206)
    at HTMLDivElement.elemData.handle (jquery.js:5014)
    at Object.trigger (jquery.js:8201)
    at HTMLDivElement.<anonymous> (jquery.js:8269)
    at Function.each (jquery.js:362)
    at jQuery.fn.init.each (jquery.js:157)
@nadnoslen
Copy link
Member Author

Should do this:

  willDestroyElement() {
    this._super(...arguments);
    const $tooltip = this.$().tooltip();
    [
      'hide.bs.tooltip',
      'hidden.bs.tooltip',
      'inserted.bs.tooltip',
      'show.bs.tooltip',
      'shown.bs.tooltip'
    ].forEach(eventName => $tooltip.off(eventName));
    this.$().tooltip('destroy');
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant