aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.tabs.js
diff options
context:
space:
mode:
authorDavid Petersen <public@petersendidit.com>2011-03-26 15:48:53 -0400
committerDavid Petersen <public@petersendidit.com>2011-03-26 21:00:45 -0400
commite7971c9077ce1f8e4f9afb123118349544bf1acb (patch)
tree2f66d3bb3a134635ba61bc947cab0c371544d957 /ui/jquery.ui.tabs.js
parent3d612445264ba1a5f76917aee78217b92b04543b (diff)
downloadjquery-ui-e7971c9077ce1f8e4f9afb123118349544bf1acb.tar.gz
jquery-ui-e7971c9077ce1f8e4f9afb123118349544bf1acb.zip
Tabs: Deprecate spinner option. Fixes #7134 Tabs: Deprecate spinner option
Diffstat (limited to 'ui/jquery.ui.tabs.js')
-rwxr-xr-xui/jquery.ui.tabs.js51
1 files changed, 32 insertions, 19 deletions
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index 617e84848..f54b166c9 100755
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -41,7 +41,6 @@ $.widget( "ui.tabs", {
remove: null,
select: null,
show: null,
- spinner: "<em>Loading&#8230;</em>",
tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
},
@@ -85,17 +84,6 @@ $.widget( "ui.tabs", {
};
},
- _cleanup: function() {
- // restore all former loading tabs labels
- this.lis.filter( ".ui-state-processing" )
- .removeClass( "ui-state-processing" )
- .find( "span:data(label.tabs)" )
- .each(function() {
- var el = $( this );
- el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
- });
- },
-
_tabify: function( init ) {
var self = this,
o = this.options,
@@ -630,11 +618,6 @@ $.widget( "ui.tabs", {
// load remote from here on
this.lis.eq( index ).addClass( "ui-state-processing" );
- if ( o.spinner ) {
- var span = $( "span", a );
- span.data( "label.tabs", span.html() ).html( o.spinner );
- }
-
this.xhr
.success( function( response ) {
self.element.find( self._sanitizeSelector( a.hash ) ).html( response );
@@ -651,8 +634,8 @@ $.widget( "ui.tabs", {
delete this.xhr;
}
- // take care of tab labels
- self._cleanup();
+
+ self.lis.eq( index ).removeClass( "ui-state-processing" );
self._trigger( "load", null, eventData );
});
@@ -755,6 +738,36 @@ if ( $.uiBackCompat !== false ) {
}
};
}( jQuery, jQuery.ui.tabs.prototype ) );
+
+ // spinner
+ (function( $, prototype ) {
+ $.extend( prototype.options, {
+ spinner: "<em>Loading&#8230;</em>"
+ });
+
+ var _create = prototype._create;
+ prototype._create = function() {
+ _create.call( this );
+ var self = this;
+
+ this.element.bind( "tabsbeforeload", function( event, ui ) {
+ if ( self.options.spinner ) {
+ var span = $( "span", ui.tab );
+ if ( span.length ) {
+ span.data( "label.tabs", span.html() ).html( self.options.spinner );
+ }
+ }
+ ui.jqXHR.complete( function() {
+ if ( self.options.spinner ) {
+ var span = $( "span", ui.tab );
+ if ( span.length ) {
+ span.html( span.data( "label.tabs" ) ).removeData( "label.tabs" );
+ }
+ }
+ });
+ });
+ };
+ }( jQuery, jQuery.ui.tabs.prototype ) );
}
})( jQuery );