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

3.3.7: Calling "destroy" twice on a shown tooltip or popover causes "Uncaught TypeError: Cannot read property 'off' of null" #20511

Closed
lddubeau opened this issue Aug 12, 2016 · 9 comments
Labels

Comments

@lddubeau
Copy link

Versions

Bootstrap: 3.3.7. It is not reproducible with 3.3.6.
Browser/OS: Chrome 51 on Debian Jessie.

How to reproduce

Run this jsbin: http://output.jsbin.com/jowiha

For the record, the code essential for reproduction is:

  $(function () {
    var $tipped = $("#tipped");
    $tipped.tooltip({
      title: "something",
      placement: "auto",
    });
    $tipped.tooltip("show");
    $tipped.tooltip("destroy");
    $tipped.tooltip("destroy");
  });

Expected behavior

The tooltip should be destroyed. No errors. The 2nd destruction should just be a no-op.

Actual behavior

The console shows:

Uncaught TypeError: Cannot read property 'off' of null

Comments

Popovers are also affected because they share the same code.

This problem was introduced in 3.3.7 with the nullification of the $element property of the tooltip.

@lddubeau
Copy link
Author

lddubeau commented Aug 17, 2016

Here is another failure related to the first one, using the same jsbin but replacing these lines:

$tipped.tooltip("show");
$tipped.tooltip("destroy");
$tipped.tooltip("destroy");

with these:

$tipped.tooltip("show");
$tipped.tooltip("destroy");
$tipped.tooltip("show");

I get the error:

bootstrap.js:1491 Uncaught TypeError: Cannot read property 'trigger' of null

The earlier error was happening in the callback passed to this.hide in the destroy method. This one happens in the complete callback that runs once the transition showing the tooltip is over.

In both cases the issue is that code scheduled to run in the future is operating on a tooltip that has been destroyed.

@martianyi
Copy link

martianyi commented Aug 24, 2016

@rsmithlal
Copy link

In my case when I got this error, I bound an event listener to "mouseout" on my element after manually showing the tooltip that would call $('selector').tooltip('destroy'), so after I called the destroy action I unbound my mouseout listener from my jq element and that fixed the issue for me.

@mdo
Copy link
Member

mdo commented Sep 5, 2016

Bootstrap 3 is no longer being officially developed or supported.

All work has moved onto our next major release, v4. As such, this issue or pull request is being closed as a "won't fix." For additional help and support, we recommend utilizing our community resources. Thanks for your understanding, and see you on the other side of v4!

<3,
@mdo and team

@xdumaine
Copy link

So v4 isn't even released as stable yet, and you're closing issues with the latest stable release as wontfix?

@stephanepericat
Copy link

stephanepericat commented Jun 13, 2017

@mdo, unfortunately, In "real" production environments, you cannot always "just upgrade" to v4... It would be nice if you guys could address this issue. Clearly, you guys do not carry out to, nor care about your Enterprise users...

@artyomtrityak
Copy link

@stephanepericat I believe this why it's open source and free. If you need something to be fixed, you can create PR and fix it. They don't get paid for things they are doing. If this is critical fix, Enterprise company can contact one of the core developers and pay for those fix.

@stephanepericat
Copy link

@artyomtrityak when you release something open source it is your responsibility to maintain it otherwise it's basically unusable and therefore useless. it's fine; we will consider other options...

@patrickhlauke
Copy link
Member

patrickhlauke commented Jun 14, 2017

Thank you for that entitled viewpoint @stephanepericat - how silly of us not to consider our enterprise users and our responsibilities, since we do this in our spare time for no payment or recognition...

@twbs twbs locked and limited conversation to collaborators Jun 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants