diff --git a/src/features/importer/js/importer.js b/src/features/importer/js/importer.js index ee21b29a3b..efe6c9d683 100644 --- a/src/features/importer/js/importer.js +++ b/src/features/importer/js/importer.js @@ -728,7 +728,7 @@ link: function ($scope, $elm, $attrs, uiGridCtrl) { var grid; - var handleFileSelect = function( event ){ + function handleFileSelect(event) { var target = event.srcElement || event.target; if (target && target.files && target.files.length === 1) { @@ -744,7 +744,7 @@ gridUtil.logError('Could not import file because UI Grid was not found.'); } } - }; + } var fileChooser = $elm[0].querySelectorAll('.ui-grid-importer-file-chooser'); @@ -753,11 +753,6 @@ } else { fileChooser[0].addEventListener('change', handleFileSelect, false); } - - $scope.$on('$destroy', function unbindEvents() { - // unbind jquery events to prevent memory leaks - fileChooser[0].removeEventListener('change', handleFileSelect, false); - }); } }; } diff --git a/src/features/importer/test/uiGridImporterMenuItemDirective.spec.js b/src/features/importer/test/uiGridImporterMenuItemDirective.spec.js index 844c4d7124..8b3b20a83a 100644 --- a/src/features/importer/test/uiGridImporterMenuItemDirective.spec.js +++ b/src/features/importer/test/uiGridImporterMenuItemDirective.spec.js @@ -54,16 +54,4 @@ describe('ui.grid.importer uiGridImporterMenuItem', function() { expect(gridUtil.logError).toHaveBeenCalledWith('Found > 1 or < 1 file choosers within the menu item, error, cannot continue'); }); - describe('on $destroy', function() { - beforeEach(function() { - spyOn(fileChooser[0], 'removeEventListener').and.callThrough(); - $scope.$broadcast('$destroy'); - }); - afterEach(function() { - fileChooser[0].removeEventListener.calls.reset(); - }); - it('should remove all event handlers', function() { - expect(fileChooser[0].removeEventListener).toHaveBeenCalled(); - }); - }); });