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

Commit

Permalink
fix(datepicker): add check for contains
Browse files Browse the repository at this point in the history
Closes #4423
Fixes #4411
  • Loading branch information
yjukaku authored and wesleycho committed Sep 16, 2015
1 parent b74c263 commit 868c0e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/datepicker/datepicker.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -713,7 +713,12 @@ function($compile, $parse, $document, $rootScope, $position, dateFilter, datePar
}); });


var documentClickBind = function(event) { var documentClickBind = function(event) {
if (scope.isOpen && !(element[0].contains(event.target) || $popup[0].contains(event.target))) { var popup = $popup[0];
var dpContainsTarget = element[0].contains(event.target);
// The popup node may not be an element node
// In some browsers (IE) only element nodes have the 'contains' function
var popupContainsTarget = popup.contains !== undefined && popup.contains(event.target);
if (scope.isOpen && !(dpContainsTarget || popupContainsTarget)) {
scope.$apply(function() { scope.$apply(function() {
scope.isOpen = false; scope.isOpen = false;
}); });
Expand Down

0 comments on commit 868c0e2

Please sign in to comment.