Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Scope leaks on tooltip show/hide #2709

Closed
bespokebob opened this issue Sep 16, 2014 · 1 comment
Closed

Scope leaks on tooltip show/hide #2709

bespokebob opened this issue Sep 16, 2014 · 1 comment

Comments

@bespokebob
Copy link

Whenever a tooltip is shown, any old tooltip element is destroyed and a new one is created. Since the tooltip element contains a tooltipPopup that creates a new scope, each show/hide of a tooltip creates a new scope that remains until the parent scope is destroyed.

To reproduce:

  1. Use something like Batarang to observe the scope hierarchy
  2. Move your mouse back and forth across an element with a tooltip
  3. Watch the list of scopes continue to grow

Adding tooltip.children().scope().$destroy() right before tooltip.remove() in removeTooltip() seems to fix the issue.

@liquidpele
Copy link

I tried to set up a plunker to demo the bug, but dev tools don't seem to see the frame the stuff is in, so here is a static html page you can just load to see the issue. Reproduced on Chrome in Win7.

<!doctype html>
<html ng-app="plunker">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<script>
angular.module('plunker', ['ui.bootstrap']);
</script>
</head>
<body style="padding:50px">
A tooltip: <a href="#" tooltip="scope leak">hover over me</a>
</body>
</html>

chrisirhc added a commit to chrisirhc/angular-ui-bootstrap that referenced this issue Nov 2, 2014
Create a new child scope and retain a reference to it so that it can
be destroyed when the tooltip DOM is removed.

Fixes angular-ui#2709
OronNadiv pushed a commit to lanetix/bootstrap that referenced this issue Nov 18, 2014
Create a new child scope and retain a reference to it so that it can
be destroyed when the tooltip DOM is removed.

Fixes angular-ui#2709
Closes angular-ui#2919
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants