From: Scott González Date: Thu, 21 Mar 2013 19:54:50 +0000 (-0400) Subject: Autocomplete: Insert the live region before the input. Fixes #9172 - Autocomplete... X-Git-Tag: 1.11.0-beta.1~398 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ff11b69a67e0176c851ff3bdec997c7a75d47a42;p=jquery-ui.git Autocomplete: Insert the live region before the input. Fixes #9172 - Autocomplete: .replaceWith() fails to replace. --- diff --git a/tests/unit/autocomplete/autocomplete_core.js b/tests/unit/autocomplete/autocomplete_core.js index a9fc1143c..6f1195910 100644 --- a/tests/unit/autocomplete/autocomplete_core.js +++ b/tests/unit/autocomplete/autocomplete_core.js @@ -188,4 +188,14 @@ test( "ARIA", function() { "Live region for multiple values" ); }); +test( ".replaceWith() (#9172)", function() { + expect( 1 ); + + var element = $( "#autocomplete" ).autocomplete(), + replacement = "
test
", + parent = element.parent(); + element.replaceWith( replacement ); + equal( parent.html(), replacement ); +}); + }( jQuery ) ); diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 3d0343379..28cfdf2fb 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -296,7 +296,7 @@ $.widget( "ui.autocomplete", { "aria-live": "polite" }) .addClass( "ui-helper-hidden-accessible" ) - .insertAfter( this.element ); + .insertBefore( this.element ); // turning off autocomplete prevents the browser from remembering the // value when navigating through history, so we re-enable autocomplete