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

Commit cd369ba

Browse files
committed
Merge branch 'Fix-1.1.0'
2 parents a7536c0 + 3e51752 commit cd369ba

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/angularjs-dropdown-multiselect.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,22 +195,24 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
195195

196196
if ($scope.settings.closeOnBlur) {
197197
$document.on('click', function (e) {
198-
var target = e.target.parentElement;
199-
var parentFound = false;
200-
201-
while (angular.isDefined(target) && target !== null && !parentFound) {
202-
if (!!target.className.split && contains(target.className.split(' '), 'multiselect-parent') && !parentFound) {
203-
if(target === $dropdownTrigger) {
204-
parentFound = true;
198+
if ($scope.open) {
199+
var target = e.target.parentElement;
200+
var parentFound = false;
201+
202+
while (angular.isDefined(target) && target !== null && !parentFound) {
203+
if (!!target.className.split && contains(target.className.split(' '), 'multiselect-parent') && !parentFound) {
204+
if(target === $dropdownTrigger) {
205+
parentFound = true;
206+
}
205207
}
208+
target = target.parentElement;
206209
}
207-
target = target.parentElement;
208-
}
209210

210-
if (!parentFound) {
211-
$scope.$apply(function () {
212-
$scope.open = false;
213-
});
211+
if (!parentFound) {
212+
$scope.$apply(function () {
213+
$scope.open = false;
214+
});
215+
}
214216
}
215217
});
216218
}

0 commit comments

Comments
 (0)