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

Commit 868c0e2

Browse files
yjukakuwesleycho
authored andcommitted
fix(datepicker): add check for contains
Closes #4423 Fixes #4411
1 parent b74c263 commit 868c0e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/datepicker/datepicker.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,12 @@ function($compile, $parse, $document, $rootScope, $position, dateFilter, datePar
713713
});
714714

715715
var documentClickBind = function(event) {
716-
if (scope.isOpen && !(element[0].contains(event.target) || $popup[0].contains(event.target))) {
716+
var popup = $popup[0];
717+
var dpContainsTarget = element[0].contains(event.target);
718+
// The popup node may not be an element node
719+
// In some browsers (IE) only element nodes have the 'contains' function
720+
var popupContainsTarget = popup.contains !== undefined && popup.contains(event.target);
721+
if (scope.isOpen && !(dpContainsTarget || popupContainsTarget)) {
717722
scope.$apply(function() {
718723
scope.isOpen = false;
719724
});

0 commit comments

Comments
 (0)