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

Commit ddf7ef0

Browse files
committed
Use .triggerHandler('click') instead of .click()
1 parent b9288bf commit ddf7ef0

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

dist/select.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ angular.module('ui.select', [])
152152

153153
function ensureHighlightVisible() {
154154
var rows = element.querySelectorAll('.ui-select-choices-row');
155-
if (!rows.length) return; // In case its empty
155+
if (!rows.length) return;
156156
var highlighted = rows[scope.$select.activeIdx],
157157
posY = highlighted.offsetTop + highlighted.clientHeight - container.scrollTop,
158158
maxHeight = 200; // TODO Need to get this value from container.max-height
@@ -191,13 +191,7 @@ angular.module('ui.select', [])
191191
}
192192

193193
} else if (evt.which === 13 || evt.which === 9) { // enter(13) and tab(9)
194-
if (window.jQuery) {
195-
// Firefox 3.6 does not support element.click()
196-
// See HTMLElement.click https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.click
197-
$(rows[scope.$select.activeIdx]).click();
198-
} else {
199-
rows[scope.$select.activeIdx].click();
200-
}
194+
angular.element(rows[scope.$select.activeIdx]).triggerHandler('click');
201195

202196
} else if (evt.which === 27) { // esc(27)
203197
evt.stopPropagation();

src/select.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ angular.module('ui.select', [])
152152

153153
function ensureHighlightVisible() {
154154
var rows = element.querySelectorAll('.ui-select-choices-row');
155-
if (!rows.length) return; // In case its empty
155+
if (!rows.length) return;
156156
var highlighted = rows[scope.$select.activeIdx],
157157
posY = highlighted.offsetTop + highlighted.clientHeight - container.scrollTop,
158158
maxHeight = 200; // TODO Need to get this value from container.max-height
@@ -191,13 +191,7 @@ angular.module('ui.select', [])
191191
}
192192

193193
} else if (evt.which === 13 || evt.which === 9) { // enter(13) and tab(9)
194-
if (window.jQuery) {
195-
// Firefox 3.6 does not support element.click()
196-
// See HTMLElement.click https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.click
197-
$(rows[scope.$select.activeIdx]).click();
198-
} else {
199-
rows[scope.$select.activeIdx].click();
200-
}
194+
angular.element(rows[scope.$select.activeIdx]).triggerHandler('click');
201195

202196
} else if (evt.which === 27) { // esc(27)
203197
evt.stopPropagation();

0 commit comments

Comments
 (0)