Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #13268
Closed
Open
Issue created Apr 03, 2014 by Administrator@rootContributor

tooltip delay causes exception if element for which tooltip was created was removed from DOM

Created by: lddubeau

I searched previous issues, did not find one that was about this precise problem.

Versions

Browsers: Chrome 33.0.1750.152, Firefox 26.0. OS: Debian testing, as of 2014-04-03. Bootstrap: The fiddle is set to load from master. At the time of writing the commit is SHA: 4c2626fe

What steps will reproduce the problem?

  1. Open this fiddle: http://jsfiddle.net/lddubeau/6yz7r/embedded/result/

  2. Perform any of these:

    a. In the "Independent" section, move quickly onto a button and click it.

    b. In the "Mutual" section, move quickly onto a button and click it.

NOTE: You must click the button before the tooltip appears. The delay is set to 1 second in the fiddle.

What is expected to happen?

The buttons should disappear without causing an unhandled exception.

What happens instead?

An unhandled exception happens. On Chrome the message is:

Uncaught TypeError: Cannot read property 'tagName' of undefined bootstrap.js:1349
   Tooltip.getPosition bootstrap.js:1349
   Tooltip.show bootstrap.js:1215
   (anonymous function) bootstrap.js:1159

Observations

The problem does not occur if:

  1. The trigger is not "delay".
  2. Auto placement is not used.

The unhandled exception happens because the element for which the tooltip is created is no longer in the DOM. When this.getPosition($parent) is called, there is no parent element and an exception occurs in getPosition.

Only the tests in the "Independent" and "Mutual" sections show the problem. The "Ancestors" section shows that if an ancestor of the element for which the tooltip is created is removed from the DOM instead of the element itself, then the show method will go through without error.

Destroying the tooltip before removing the element for which it is created would prevent the problem. However, cases where GUI changes are triggered by automated processes (not under the control of the user) make catching the removal of such elements difficult in the general case.

Checking whether $parent is an actual element, and bailing out of show if it is not, is the cleaner solution.

Assignee
Assign to
Time tracking