diff options
author | Stefan Giehl <stefan@piwik.org> | 2017-10-06 06:28:23 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-10-06 06:28:23 +0300 |
commit | c78f973545b7c0190aeaf0cdd50a1d629a15afad (patch) | |
tree | 35d58174e4231b2b82e98fb2ba70d91ccb76f0c9 | |
parent | 43e14ed09d4d81219c16c1ec7b54f152f110e99f (diff) |
fixes js memory leak (#12130)
-rw-r--r-- | plugins/Dashboard/angularjs/dashboard/dashboard.directive.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/Dashboard/angularjs/dashboard/dashboard.directive.js b/plugins/Dashboard/angularjs/dashboard/dashboard.directive.js index 04c1a8e6a5..141be1a97d 100644 --- a/plugins/Dashboard/angularjs/dashboard/dashboard.directive.js +++ b/plugins/Dashboard/angularjs/dashboard/dashboard.directive.js @@ -38,7 +38,9 @@ name: dashboard ? dashboard.name : '' }); - $('#columnPreview').find('>div').each(function () { + var divElements = $('#columnPreview').find('>div'); + + divElements.each(function () { var width = []; $('div', this).each(function () { width.push(this.className.replace(/width-/, '')); @@ -46,8 +48,9 @@ $(this).attr('layout', width.join('-')); }); - $('#columnPreview').find('>div').on('click', function () { - $('#columnPreview').find('>div').removeClass('choosen'); + divElements.off('click.renderDashboard'); + divElements.on('click.renderDashboard', function () { + divElements.removeClass('choosen'); $(this).addClass('choosen'); }); } |