@@ -40,6 +40,7 @@ $.widget( "ui.autocomplete", {
40
40
options : {
41
41
appendTo : null ,
42
42
autoFocus : false ,
43
+ classes : { } ,
43
44
delay : 300 ,
44
45
minLength : 1 ,
45
46
position : {
@@ -87,9 +88,8 @@ $.widget( "ui.autocomplete", {
87
88
this . valueMethod = this . element [ isTextarea || isInput ? "val" : "text" ] ;
88
89
this . isNewMenu = true ;
89
90
90
- this . element
91
- . addClass ( "ui-autocomplete-input" )
92
- . attr ( "autocomplete" , "off" ) ;
91
+ this . _addClass ( "ui-autocomplete-input" ) ;
92
+ this . element . attr ( "autocomplete" , "off" ) ;
93
93
94
94
this . _on ( this . element , {
95
95
keydown : function ( event ) {
@@ -210,7 +210,6 @@ $.widget( "ui.autocomplete", {
210
210
211
211
this . _initSource ( ) ;
212
212
this . menu = $ ( "<ul>" )
213
- . addClass ( "ui-autocomplete ui-front" )
214
213
. appendTo ( this . _appendTo ( ) )
215
214
. menu ( {
216
215
// disable ARIA support, the live region takes care of that
@@ -219,6 +218,7 @@ $.widget( "ui.autocomplete", {
219
218
. hide ( )
220
219
. menu ( "instance" ) ;
221
220
221
+ this . _addClass ( this . menu . element , "ui-autocomplete" , "ui-front" ) ;
222
222
this . _on ( this . menu . element , {
223
223
mousedown : function ( event ) {
224
224
// prevent moving focus out of the text field
@@ -315,9 +315,10 @@ $.widget( "ui.autocomplete", {
315
315
"aria-live" : "assertive" ,
316
316
"aria-relevant" : "additions"
317
317
} )
318
- . addClass ( "ui-helper-hidden-accessible" )
319
318
. appendTo ( this . document [ 0 ] . body ) ;
320
319
320
+ this . _addClass ( this . liveRegion , null , "ui-helper-hidden-accessible" ) ;
321
+
321
322
// turning off autocomplete prevents the browser from remembering the
322
323
// value when navigating through history, so we re-enable autocomplete
323
324
// if the page is unloaded before the widget is destroyed. #7790
@@ -330,9 +331,7 @@ $.widget( "ui.autocomplete", {
330
331
331
332
_destroy : function ( ) {
332
333
clearTimeout ( this . searching ) ;
333
- this . element
334
- . removeClass ( "ui-autocomplete-input" )
335
- . removeAttr ( "autocomplete" ) ;
334
+ this . element . removeAttr ( "autocomplete" ) ;
336
335
this . menu . element . remove ( ) ;
337
336
this . liveRegion . remove ( ) ;
338
337
} ,
@@ -436,7 +435,7 @@ $.widget( "ui.autocomplete", {
436
435
437
436
_search : function ( value ) {
438
437
this . pending ++ ;
439
- this . element . addClass ( "ui-autocomplete-loading" ) ;
438
+ this . _addClass ( "ui-autocomplete-loading" ) ;
440
439
this . cancelSearch = false ;
441
440
442
441
this . source ( { term : value } , this . _response ( ) ) ;
@@ -452,7 +451,7 @@ $.widget( "ui.autocomplete", {
452
451
453
452
this . pending -- ;
454
453
if ( ! this . pending ) {
455
- this . element . removeClass ( "ui-autocomplete-loading" ) ;
454
+ this . _removeClass ( "ui-autocomplete-loading" ) ;
456
455
}
457
456
} , this ) ;
458
457
} ,
0 commit comments