diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-12-17 10:48:17 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-12-18 14:44:18 -0500 |
commit | d2a12ff825ebb0e620b25abdbcbaf024881ef537 (patch) | |
tree | 9f9b75e6e33bf41b7366d35d550a4c03bf4f6fcb | |
parent | ffc08557ad764d7aca17ea1c6e75a62f6eb65c15 (diff) | |
download | jquery-ui-d2a12ff825ebb0e620b25abdbcbaf024881ef537.tar.gz jquery-ui-d2a12ff825ebb0e620b25abdbcbaf024881ef537.zip |
Autocomplete: Abort pending ajax requests when disabled and prevent handling results when disabled. Fixes #6752 - Menu may still render when autocomplete is disabled.
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 95e221035..84d76ec08 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -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() { @@ -243,7 +246,7 @@ $.widget( "ui.autocomplete", { } else if ( typeof this.options.source === "string" ) { url = this.options.source; this.source = function( request, response ) { - if (self.xhr) { + if ( self.xhr ) { self.xhr.abort(); } self.xhr = $.ajax({ @@ -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" ); |