aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-02-27 15:11:33 -0500
committerAlexander Schmitz <arschmitz@gmail.com>2015-03-11 16:02:12 -0400
commitcff1fb2a13e18403c02ba516e08db3a5b21a8b6c (patch)
tree030ff586f37b4384b1a3be776c21eb3ae5ac29ba /ui
parent7c6a7d71e98cbeea21bfc1560f8a82484a3c9510 (diff)
downloadjquery-ui-cff1fb2a13e18403c02ba516e08db3a5b21a8b6c.tar.gz
jquery-ui-cff1fb2a13e18403c02ba516e08db3a5b21a8b6c.zip
Autocomplete: Add classes option
Ref #7053 Ref gh-1411
Diffstat (limited to 'ui')
-rw-r--r--ui/autocomplete.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/ui/autocomplete.js b/ui/autocomplete.js
index 60d69307e..3453ee399 100644
--- a/ui/autocomplete.js
+++ b/ui/autocomplete.js
@@ -40,6 +40,7 @@ $.widget( "ui.autocomplete", {
options: {
appendTo: null,
autoFocus: false,
+ classes: {},
delay: 300,
minLength: 1,
position: {
@@ -87,9 +88,8 @@ $.widget( "ui.autocomplete", {
this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
this.isNewMenu = true;
- this.element
- .addClass( "ui-autocomplete-input" )
- .attr( "autocomplete", "off" );
+ this._addClass( "ui-autocomplete-input" );
+ this.element.attr( "autocomplete", "off" );
this._on( this.element, {
keydown: function( event ) {
@@ -210,7 +210,6 @@ $.widget( "ui.autocomplete", {
this._initSource();
this.menu = $( "<ul>" )
- .addClass( "ui-autocomplete ui-front" )
.appendTo( this._appendTo() )
.menu({
// disable ARIA support, the live region takes care of that
@@ -219,6 +218,7 @@ $.widget( "ui.autocomplete", {
.hide()
.menu( "instance" );
+ this._addClass( this.menu.element, "ui-autocomplete", "ui-front" );
this._on( this.menu.element, {
mousedown: function( event ) {
// prevent moving focus out of the text field
@@ -315,9 +315,10 @@ $.widget( "ui.autocomplete", {
"aria-live": "assertive",
"aria-relevant": "additions"
})
- .addClass( "ui-helper-hidden-accessible" )
.appendTo( this.document[ 0 ].body );
+ this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
+
// turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete
// if the page is unloaded before the widget is destroyed. #7790
@@ -330,9 +331,7 @@ $.widget( "ui.autocomplete", {
_destroy: function() {
clearTimeout( this.searching );
- this.element
- .removeClass( "ui-autocomplete-input" )
- .removeAttr( "autocomplete" );
+ this.element.removeAttr( "autocomplete" );
this.menu.element.remove();
this.liveRegion.remove();
},
@@ -436,7 +435,7 @@ $.widget( "ui.autocomplete", {
_search: function( value ) {
this.pending++;
- this.element.addClass( "ui-autocomplete-loading" );
+ this._addClass( "ui-autocomplete-loading" );
this.cancelSearch = false;
this.source( { term: value }, this._response() );
@@ -452,7 +451,7 @@ $.widget( "ui.autocomplete", {
this.pending--;
if ( !this.pending ) {
- this.element.removeClass( "ui-autocomplete-loading" );
+ this._removeClass( "ui-autocomplete-loading" );
}
}, this );
},