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

Commit 3e51752

Browse files
committed
Merge branch 'pr/n4_pkempenaers' into Fix-1.1.0
# Conflicts: # dist/angularjs-dropdown-multiselect.min.js # src/angularjs-dropdown-multiselect.js
2 parents 4ef3379 + fedbfaa commit 3e51752

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
@@ -157,22 +157,24 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
157157

158158
if ($scope.settings.closeOnBlur) {
159159
$document.on('click', function (e) {
160-
var target = e.target.parentElement;
161-
var parentFound = false;
162-
163-
while (angular.isDefined(target) && target !== null && !parentFound) {
164-
if (!!target.className.split && contains(target.className.split(' '), 'multiselect-parent') && !parentFound) {
165-
if(target === $dropdownTrigger) {
166-
parentFound = true;
160+
if ($scope.open) {
161+
var target = e.target.parentElement;
162+
var parentFound = false;
163+
164+
while (angular.isDefined(target) && target !== null && !parentFound) {
165+
if (!!target.className.split && contains(target.className.split(' '), 'multiselect-parent') && !parentFound) {
166+
if(target === $dropdownTrigger) {
167+
parentFound = true;
168+
}
167169
}
170+
target = target.parentElement;
168171
}
169-
target = target.parentElement;
170-
}
171172

172-
if (!parentFound) {
173-
$scope.$apply(function () {
174-
$scope.open = false;
175-
});
173+
if (!parentFound) {
174+
$scope.$apply(function () {
175+
$scope.open = false;
176+
});
177+
}
176178
}
177179
});
178180
}

0 commit comments

Comments
 (0)