diff options
author | David Petersen <public@petersendidit.com> | 2011-03-26 16:12:05 -0400 |
---|---|---|
committer | David Petersen <public@petersendidit.com> | 2011-03-26 21:00:45 -0400 |
commit | e5f081bc1c16c051665eafc22c9a7af3fba456c8 (patch) | |
tree | 3062b542da69ec209b2e905451be3ce68a72334e /ui/jquery.ui.tabs.js | |
parent | e7971c9077ce1f8e4f9afb123118349544bf1acb (diff) | |
download | jquery-ui-e5f081bc1c16c051665eafc22c9a7af3fba456c8.tar.gz jquery-ui-e5f081bc1c16c051665eafc22c9a7af3fba456c8.zip |
Tabs: Deprecate enable and disable events. Fixes #7142 Tabs: Deprecate enable and disable events
Diffstat (limited to 'ui/jquery.ui.tabs.js')
-rwxr-xr-x | ui/jquery.ui.tabs.js | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index f54b166c9..b7a270fb6 100755 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -30,9 +30,7 @@ $.widget( "ui.tabs", { beforeload: null, cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } collapsible: false, - disable: null, disabled: false, - enable: null, event: "click", fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } idPrefix: "ui-tabs-", @@ -545,7 +543,6 @@ $.widget( "ui.tabs", { o.disabled = false; } - this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); return this; }, @@ -569,7 +566,6 @@ $.widget( "ui.tabs", { o.disabled = true; } - this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); } return this; @@ -768,6 +764,47 @@ if ( $.uiBackCompat !== false ) { }); }; }( jQuery, jQuery.ui.tabs.prototype ) ); + + // enable/disable events + (function( $, prototype ) { + $.extend( prototype.options, { + enable: null, + disable: null + }); + + var enable = prototype.enable, + disable = prototype.disable; + + prototype.enable = function( index ) { + var o = this.options, + trigger; + + if ( index && o.disabled || ($.isArray( o.disabled ) && $.inArray( index, o.disabled ) !== -1 ) ) { + trigger = true; + } + + enable.apply( this, arguments ); + + if ( trigger ) { + this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + } + }; + + prototype.disable = function( index ) { + var o = this.options, + trigger; + + if ( index && !o.disabled || ($.isArray( o.disabled ) && $.inArray( index, o.disabled ) == -1 ) ) { + trigger = true; + } + + disable.apply( this, arguments ); + + if ( trigger ) { + this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + } + }; + }( jQuery, jQuery.ui.tabs.prototype ) ); } })( jQuery ); |