diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-05-10 13:56:59 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-05-10 13:56:59 -0400 |
commit | 7fddb1c5b5137887f6c145f54e47f946ceb9741d (patch) | |
tree | 72e7a4d775517e571a3f6d4fff5581ff610fa03d /ui | |
parent | 319c5eb2c123c24983e38cc9d9fe3058ab045cf4 (diff) | |
download | jquery-ui-7fddb1c5b5137887f6c145f54e47f946ceb9741d.tar.gz jquery-ui-7fddb1c5b5137887f6c145f54e47f946ceb9741d.zip |
Tabs: Fixed show event.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.tabs.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index cd9b04f0d..dca6a538d 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -108,15 +108,7 @@ $.widget( "ui.tabs", { var panel = that._getPanelForTab( this.active ); panel.show(); - this.lis.eq( options.active ).addClass( "ui-tabs-active ui-state-active" ); - - // TODO: we need to remove this or add it to accordion - // seems to be expected behavior that the activate callback is fired - that.element.queue( "tabs", function() { - that._trigger( "activate", null, that._ui( that.active[ 0 ], panel[ 0 ] ) ); - }); - this.load( options.active ); } else { this.active = $(); @@ -968,8 +960,16 @@ if ( $.uiBackCompat !== false ) { show: null, select: null }); - var _trigger = prototype._trigger; + var _create = prototype._create, + _trigger = prototype._trigger; + prototype._create = function() { + _create.call( this ); + if ( this.options.active !== false ) { + this._trigger( "show", null, this._ui( + this.active[ 0 ], this._getPanelForTab( this.active )[ 0 ] ) ); + } + } prototype._trigger = function( type, event, data ) { var ret = _trigger.apply( this, arguments ); if ( !ret ) { @@ -981,8 +981,12 @@ if ( $.uiBackCompat !== false ) { panel: data.newPanel[ 0 ], index: data.newTab.closest( "li" ).index() }); - } else if ( type === "activate" ) { - ret = _trigger.call( this, "show", event, data ); + } else if ( type === "activate" && data.newTab.length ) { + ret = _trigger.call( this, "show", event, { + tab: data.newTab[ 0 ], + panel: data.newPanel[ 0 ], + index: data.newTab.closest( "li" ).index() + }); } }; }( jQuery, jQuery.ui.tabs.prototype ) ); |