This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typeahead): dangling event listeners
- Loading branch information
1 parent
97fd37e
commit 94fb282
Showing
2 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -359,6 +359,11 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position']) | |
if (appendToBody || appendToElementId) { | ||
$popup.remove(); | ||
} | ||
|
||
if (appendToBody) { | ||
angular.element($window).unbind('resize', fireRecalculating); | ||
$document.find('body').unbind('scroll', fireRecalculating); | ||
} | ||
// Prevent jQuery cache memory leak | ||
popUpEl.remove(); | ||
}); | ||
|
@@ -937,6 +942,11 @@ angular.module('ui.bootstrap.typeahead') | |
if (appendToBody || appendToElementId) { | ||
$popup.remove(); | ||
} | ||
|
||
if (appendToBody) { | ||
angular.element($window).unbind('resize', fireRecalculating); | ||
$document.find('body').unbind('scroll', fireRecalculating); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Foxandxss
Contributor
|
||
} | ||
// Prevent jQuery cache memory leak | ||
popUpEl.remove(); | ||
}); | ||
|
Just an FYI, we should use 'on' and 'off' instead of 'bind' and 'unbind' which simply call the 'on' and 'off' functions, see here