Autocomplete: Abort pending ajax requests when disabled and prevent handling results when disabled. Fixes #6752 - Menu may still render when autocomplete is disabled.

This commit is contained in:
Scott González 2010-12-17 10:48:17 -05:00
parent ffc08557ad
commit d2a12ff825

View File

@ -229,6 +229,9 @@ $.widget( "ui.autocomplete", {
if ( key === "appendTo" ) {
this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
}
if ( key === "disabled" && value && this.xhr ) {
this.xhr.abort();
}
},
_initSource: function() {
@ -294,7 +297,7 @@ $.widget( "ui.autocomplete", {
},
_response: function( content ) {
if ( content && content.length ) {
if ( !this.options.disabled && content && content.length ) {
content = this._normalize( content );
this._suggest( content );
this._trigger( "open" );