]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: Re-enable native autocomplete whent he page is unloaded. Fixes #7790...
authorScott González <scott.gonzalez@gmail.com>
Mon, 17 Oct 2011 13:25:36 +0000 (09:25 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 17 Oct 2011 13:25:36 +0000 (09:25 -0400)
ui/jquery.ui.autocomplete.js

index 6b9ee4b3afdc00956c101a42b22b3593d5a5354a..ab2edfdffdaf574b269aa8eb2520de196510bc4a 100644 (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() {