Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit 8203528

Browse files
committed
Fix to remove only onClickOnWindow event listener from $window
1 parent 003f44f commit 8203528

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/js/angular-datepicker.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,14 +751,16 @@
751751
isMouseOn = true;
752752
});
753753

754-
angular.element($window).on('click focus focusin', function onClickOnWindow() {
754+
var onClickOnWindow = function() {
755755

756756
if (!isMouseOn &&
757757
!isMouseOnInput && theCalendar) {
758758

759759
$scope.hideCalendar();
760760
}
761-
});
761+
};
762+
763+
angular.element($window).on('click focus focusin', onClickOnWindow);
762764

763765
//check always if given range of dates is ok
764766
if ($scope.dateMinLimit &&
@@ -783,7 +785,7 @@
783785
unregisterDataSetWatcher();
784786
thisInput.off('focus click focusout blur');
785787
angular.element(theCalendar).off('mouseenter mouseleave focusin');
786-
angular.element($window).off('click focus');
788+
angular.element($window).off('click focus focusin', onClickOnWindow);
787789
});
788790
};
789791

0 commit comments

Comments
 (0)