aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-10-17 09:25:36 -0400
committerScott González <scott.gonzalez@gmail.com>2011-10-17 09:25:36 -0400
commit81b2ef4a6088cb99863c2d318947355a58019362 (patch)
treeab605411ff25d212a7ec334512dab5d518db7159
parent63374dcb520f5ad7104ccb57b8eb01dca4087889 (diff)
downloadjquery-ui-81b2ef4a6088cb99863c2d318947355a58019362.tar.gz
jquery-ui-81b2ef4a6088cb99863c2d318947355a58019362.zip
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.
-rw-r--r--ui/jquery.ui.autocomplete.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 6b9ee4b3a..ab2edfdff 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -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() {