]> source.dussan.org Git - jquery-ui.git/commitdiff
Tabs: Force ajax tabs to resolve asynchronously to avoid a bug caused by cached XHRs...
authorScott González <scott.gonzalez@gmail.com>
Mon, 10 Oct 2011 19:34:47 +0000 (15:34 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 10 Oct 2011 19:34:47 +0000 (15:34 -0400)
tests/unit/tabs/tabs_events.js
ui/jquery.ui.tabs.js

index 12c9bb87b3e6d4ebdf90cc65066fe36233e366bd..f5cde180bb6ab8e77e737bba4258bf578a7fe10a 100644 (file)
@@ -206,7 +206,8 @@ test( "beforeLoad", function() {
        });
        element.find( ".ui-tabs-nav a" ).eq( 3 ).click();
        tabs_state( element, 0, 0, 0, 1, 0 );
-       equals( panel.html(), "<p>testing</p>", "panel html after" );
+       // .toLowerCase() is needed to convert <P> to <p> in old IEs
+       equals( panel.html().toLowerCase(), "<p>testing</p>", "panel html after" );
 });
 
 if ( $.uiBackCompat === false ) {
index a1bf72cb1357a7089d4c71d5d80089a4baa33783..4127ddf84a9f98b53263d2af390d5a864058ba74 100644 (file)
@@ -541,19 +541,27 @@ $.widget( "ui.tabs", {
 
                        this.xhr
                                .success(function( response ) {
-                                       panel.html( response );
-                                       self._trigger( "load", event, eventData );
+                                       // TODO: IE resolves cached XHRs immediately
+                                       // remove when core #10467 is fixed
+                                       setTimeout(function() {
+                                               panel.html( response );
+                                               self._trigger( "load", event, eventData );
+                                       }, 1 );
                                })
                                .complete(function( jqXHR, status ) {
-                                       if ( status === "abort" ) {
-                                               self.panels.stop( false, true );
-                                       }
-
-                                       self.lis.eq( index ).removeClass( "ui-tabs-loading" );
-
-                                       if ( jqXHR === self.xhr ) {
-                                               delete self.xhr;
-                                       }
+                                       // TODO: IE resolves cached XHRs immediately
+                                       // remove when core #10467 is fixed
+                                       setTimeout(function() {
+                                               if ( status === "abort" ) {
+                                                       self.panels.stop( false, true );
+                                               }
+       
+                                               self.lis.eq( index ).removeClass( "ui-tabs-loading" );
+       
+                                               if ( jqXHR === self.xhr ) {
+                                                       delete self.xhr;
+                                               }
+                                       });
                                });
                }