@@ -174,8 +174,7 @@ angular.module('ui.select', [])
174
174
ctrl . refresh = function ( refreshAttr ) {
175
175
if ( refreshAttr !== undefined ) {
176
176
177
- // Throttle / debounce
178
- //
177
+ // Debounce
179
178
// See https://github.com/angular-ui/bootstrap/blob/0.10.0/src/typeahead/typeahead.js#L155
180
179
// FYI AngularStrap typeahead does not have debouncing: https://github.com/mgcrea/angular-strap/blob/v2.0.0-rc.4/src/typeahead/typeahead.js#L177
181
180
if ( _refreshDelayPromise ) {
@@ -233,7 +232,6 @@ angular.module('ui.select', [])
233
232
}
234
233
235
234
// Bind to keyboard shortcuts
236
- // Cannot specify a namespace: not supported by jqLite
237
235
_searchInput . on ( 'keydown' , function ( e ) {
238
236
// Keyboard shortcuts are all about the items,
239
237
// does not make sense (and will crash) if ctrl.items is empty
@@ -324,8 +322,7 @@ angular.module('ui.select', [])
324
322
$select . selected = ngModel . $viewValue ;
325
323
} ;
326
324
327
- // See Click everywhere but here event http://stackoverflow.com/questions/12931369
328
- $document . on ( 'mousedown' , function ( e ) {
325
+ function onDocumentClick ( e ) {
329
326
var contains = false ;
330
327
331
328
if ( window . jQuery ) {
@@ -340,10 +337,13 @@ angular.module('ui.select', [])
340
337
$select . close ( ) ;
341
338
scope . $digest ( ) ;
342
339
}
343
- } ) ;
340
+ }
341
+
342
+ // See Click everywhere but here event http://stackoverflow.com/questions/12931369
343
+ $document . on ( 'click' , onDocumentClick ) ;
344
344
345
345
scope . $on ( '$destroy' , function ( ) {
346
- $document . off ( 'mousedown' ) ;
346
+ $document . off ( 'click' , onDocumentClick ) ;
347
347
} ) ;
348
348
349
349
// Move transcluded elements to their correct position in main template
0 commit comments