Problem with autocomplete and loading-icon

Problem with autocomplete and loading-icon

Hi.

I use ajax calls to get my results in autocomplete (I love it!). But its happen very very often, that the loading-icon (class .ui-autocomplete-loading) don't hide after result popup is show up. That happen in 1.9.x and in 1.10.0.

Can anybody help me here? :)


jquery.ui.autocomplete.js:
  1.     _search: function( value ) {
  2.         this.pending++;
  3.         this.element.addClass( "ui-autocomplete-loading" );
  4.         this.cancelSearch = false;
  5.         this.source( { term: value }, this._response() );
  6.     },

  1.     _response: function() {
  2.         var that = this,
  3.             index = ++requestIndex;
  4.         return function( content ) {
  5.             if ( index === requestIndex ) {
  6.                 that.__response( content );
  7.             }
  8.             that.pending--;
  9.             if ( !that.pending ) {
  10.                 that.element.removeClass( "ui-autocomplete-loading" );
  11.             }
  12.         };
  13.     },