Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/select.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* ui-select
* http://github.com/angular-ui/ui-select
* Version: 0.19.8 - 2018-10-15T10:14:30.715Z
* Version: 0.19.8 - 2018-11-13T17:44:25.067Z
* License: MIT
*/

Expand Down
82 changes: 42 additions & 40 deletions dist/select.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/select.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/select.min.css.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/select.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/select.min.js.map

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions src/uiSelectDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,24 @@ uis.directive('uiSelect',
if (!$select.open) return; //Skip it if dropdown is close

var contains = false;
var target = e.target || e.srcElement;

if (window.jQuery) {
// Firefox 3.6 does not support element.contains()
// See Node.contains https://developer.mozilla.org/en-US/docs/Web/API/Node.contains
contains = window.jQuery.contains(element[0], e.target);
contains = window.jQuery.contains(element[0], target);
} else {
contains = element[0].contains(e.target);
contains = element[0].contains(target);
}

if (!contains && !$select.clickTriggeredSelect) {
var skipFocusser;
if (!$select.skipFocusser) {
//Will lose focus only with certain targets
var focusableControls = ['input','button','textarea','select'];
var targetController = angular.element(e.target).controller('uiSelect'); //To check if target is other ui-select
var targetController = angular.element(target).controller('uiSelect'); //To check if target is other ui-select
skipFocusser = targetController && targetController !== $select; //To check if target is other ui-select
if (!skipFocusser) skipFocusser = ~focusableControls.indexOf(e.target.tagName.toLowerCase()); //Check if target is input, button or textarea
if (!skipFocusser) skipFocusser = ~focusableControls.indexOf(target.tagName.toLowerCase()); //Check if target is input, button or textarea
} else {
skipFocusser = true;
}
Expand All @@ -206,11 +207,12 @@ uis.directive('uiSelect',
$select.clickTriggeredSelect = false;
}

// See Click everywhere but here event http://stackoverflow.com/questions/12931369
$document.on('click', onDocumentClick);
// Close the event handler when any event is clicked. This should capture in case any parent
// element cancels propagation of the click event. RIP IE8. http://stackoverflow.com/questions/12931369
document.addEventListener('click', onDocumentClick, true);

scope.$on('$destroy', function() {
$document.off('click', onDocumentClick);
document.removeEventListener('click', onDocumentClick, true);
});

// Move transcluded elements to their correct position in main template
Expand Down