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

fix(dropdown): added null check to .focus & .contains #6280

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 4 additions & 3 deletions src/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
if (evt && evt.which === 3) { return; }

var toggleElement = openScope.getToggleElement();
if (evt && toggleElement && toggleElement[0].contains(evt.target)) {
if (evt && toggleElement && toggleElement[0].contains && toggleElement[0].contains(evt.target)) {
return;
}

var dropdownElement = openScope.getDropdownElement();
if (evt && openScope.getAutoClose() === 'outsideClick' &&
dropdownElement && dropdownElement[0].contains(evt.target)) {
dropdownElement && dropdownElement[0].contains && dropdownElement[0].contains(evt.target)) {
return;
}

Expand Down Expand Up @@ -186,7 +186,8 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
};

scope.focusToggleElement = function() {
if (self.toggleElement) {
// Add a null check to .focus here. Some elements, such as svg in IE, may not have focus
if (self.toggleElement && self.toggleElement[0].focus) {
self.toggleElement[0].focus();
}
};
Expand Down