@@ -110,7 +110,7 @@ $.widget( "ui.autocomplete", {
110
110
}
111
111
break ;
112
112
case keyCode . ESCAPE :
113
- if ( this . menu . element . is ( ":visible" ) ) {
113
+ if ( this . menu . element . is ( ":visible" ) ) {
114
114
this . _value ( this . term ) ;
115
115
this . close ( event ) ;
116
116
// Different browsers have different default behavior for escape
@@ -178,9 +178,9 @@ $.widget( "ui.autocomplete", {
178
178
} ) ;
179
179
180
180
this . _initSource ( ) ;
181
- this . menu = $ ( "<ul></ul> " )
181
+ this . menu = $ ( "<ul>" )
182
182
. addClass ( "ui-autocomplete" )
183
- . appendTo ( this . document . find ( this . options . appendTo || "body" ) [ 0 ] )
183
+ . appendTo ( this . document . find ( this . options . appendTo || "body" ) [ 0 ] )
184
184
. menu ( {
185
185
// custom key handling for now
186
186
input : $ ( ) ,
@@ -210,7 +210,7 @@ $.widget( "ui.autocomplete", {
210
210
if ( ! $ ( event . target ) . closest ( ".ui-menu-item" ) . length ) {
211
211
this . _delay ( function ( ) {
212
212
var that = this ;
213
- this . document . one ( ' mousedown' , function ( event ) {
213
+ this . document . one ( " mousedown" , function ( event ) {
214
214
if ( event . target !== that . element [ 0 ] &&
215
215
event . target !== menuElement &&
216
216
! $ . contains ( menuElement , event . target ) ) {
@@ -224,7 +224,7 @@ $.widget( "ui.autocomplete", {
224
224
// #7024 - Prevent accidental activation of menu items in Firefox
225
225
if ( this . isNewMenu ) {
226
226
this . isNewMenu = false ;
227
- if ( event . originalEvent && / ^ m o u s e / . test ( event . originalEvent . type ) ) {
227
+ if ( event . originalEvent && / ^ m o u s e / . test ( event . originalEvent . type ) ) {
228
228
this . menu . blur ( ) ;
229
229
230
230
this . document . one ( "mousemove" , function ( ) {
@@ -240,7 +240,7 @@ $.widget( "ui.autocomplete", {
240
240
var item = ui . item . data ( "ui-autocomplete-item" ) || ui . item . data ( "item.autocomplete" ) ;
241
241
if ( false !== this . _trigger ( "focus" , event , { item : item } ) ) {
242
242
// use value to match what will end up in the input, if it was a key event
243
- if ( event . originalEvent && / ^ k e y / . test ( event . originalEvent . type ) ) {
243
+ if ( event . originalEvent && / ^ k e y / . test ( event . originalEvent . type ) ) {
244
244
this . _value ( item . value ) ;
245
245
}
246
246
} else {
@@ -330,13 +330,12 @@ $.widget( "ui.autocomplete", {
330
330
} ,
331
331
332
332
_initSource : function ( ) {
333
- var that = this ,
334
- array ,
335
- url ;
333
+ var array , url ,
334
+ that = this ;
336
335
if ( $ . isArray ( this . options . source ) ) {
337
336
array = this . options . source ;
338
337
this . source = function ( request , response ) {
339
- response ( $ . ui . autocomplete . filter ( array , request . term ) ) ;
338
+ response ( $ . ui . autocomplete . filter ( array , request . term ) ) ;
340
339
} ;
341
340
} else if ( typeof this . options . source === "string" ) {
342
341
url = this . options . source ;
@@ -434,7 +433,7 @@ $.widget( "ui.autocomplete", {
434
433
435
434
_close : function ( event ) {
436
435
clearTimeout ( this . closing ) ;
437
- if ( this . menu . element . is ( ":visible" ) ) {
436
+ if ( this . menu . element . is ( ":visible" ) ) {
438
437
this . menu . element . hide ( ) ;
439
438
this . menu . blur ( ) ;
440
439
this . isNewMenu = true ;
@@ -453,7 +452,7 @@ $.widget( "ui.autocomplete", {
453
452
if ( items . length && items [ 0 ] . label && items [ 0 ] . value ) {
454
453
return items ;
455
454
}
456
- return $ . map ( items , function ( item ) {
455
+ return $ . map ( items , function ( item ) {
457
456
if ( typeof item === "string" ) {
458
457
return {
459
458
label : item ,
@@ -510,18 +509,18 @@ $.widget( "ui.autocomplete", {
510
509
} ,
511
510
512
511
_renderItem : function ( ul , item ) {
513
- return $ ( "<li></li> " )
514
- . append ( $ ( "<a></a> " ) . text ( item . label ) )
512
+ return $ ( "<li>" )
513
+ . append ( $ ( "<a>" ) . text ( item . label ) )
515
514
. appendTo ( ul ) ;
516
515
} ,
517
516
518
517
_move : function ( direction , event ) {
519
- if ( ! this . menu . element . is ( ":visible" ) ) {
518
+ if ( ! this . menu . element . is ( ":visible" ) ) {
520
519
this . search ( null , event ) ;
521
520
return ;
522
521
}
523
- if ( this . menu . isFirstItem ( ) && / ^ p r e v i o u s / . test ( direction ) ||
524
- this . menu . isLastItem ( ) && / ^ n e x t / . test ( direction ) ) {
522
+ if ( this . menu . isFirstItem ( ) && / ^ p r e v i o u s / . test ( direction ) ||
523
+ this . menu . isLastItem ( ) && / ^ n e x t / . test ( direction ) ) {
525
524
this . _value ( this . term ) ;
526
525
this . menu . blur ( ) ;
527
526
return ;
0 commit comments