From 81b2ef4a6088cb99863c2d318947355a58019362 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 17 Oct 2011 09:25:36 -0400 Subject: [PATCH] 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. --- ui/jquery.ui.autocomplete.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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() { -- 2.39.5