Autocomplete: Re-enable native autocomplete whent he page is unloaded. Fixes #7790 - Autocomplete-enabled text input does not keep value when using back button in browser.

This commit is contained in:
Scott González 2011-10-17 09:25:36 -04:00
parent 63374dcb52
commit 81b2ef4a60

View File

@ -265,9 +265,19 @@ $.widget( "ui.autocomplete", {
.zIndex( this.element.zIndex() + 1 )
.hide()
.data( "menu" );
if ( $.fn.bgiframe ) {
this.menu.element.bgiframe();
}
// 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
this._bind( doc.defaultView, {
beforeunload: function() {
this.element.removeAttr( "autocomplete" );
}
});
},
_destroy: function() {