Tabs: Removed ajaxOptions and cache options. Fixes #7147 - Tabs: Remove ajaxOptions and cache options.

This commit is contained in:
Scott González 2012-10-25 05:27:33 -04:00
parent 974e5f8196
commit 52a184e31c
3 changed files with 0 additions and 120 deletions

View File

@ -1,8 +1,6 @@
TestHelpers.commonWidgetTests( "tabs", {
defaults: {
active: null,
ajaxOptions: null,
cache: false,
collapsible: false,
cookie: null,
disabled: false,

View File

@ -24,59 +24,6 @@ test( "panel ids", function() {
module( "tabs (deprecated): options" );
asyncTest( "ajaxOptions", function() {
expect( 2 );
var element = $( "#tabs2" ).tabs({
ajaxOptions: {
data: "foo=bar",
converters: {
"text html": function() {
return "test";
}
}
}
});
element.one( "tabsbeforeload", function( event, ui ) {
equal( ui.ajaxSettings.url.replace( /^[^\?]+/, "" ), "?foo=bar", "ajaxOptions.data" );
});
element.one( "tabsload", function( event, ui ) {
equal( $( ui.panel ).html(), "test" );
start();
});
element.tabs( "option", "active", 2 );
});
asyncTest( "cache", function() {
expect( 5 );
var element = $( "#tabs2" ).tabs({
cache: true
});
element.one( "tabsshow", function() {
state( element, 0, 0, 1, 0, 0 );
});
element.one( "tabsload", function() {
ok( true, "tabsload" );
setTimeout(function() {
element.tabs( "option", "active", 0 );
state( element, 1, 0, 0, 0, 0 );
element.one( "tabsshow", function() {
state( element, 0, 0, 1, 0, 0 );
});
element.one( "tabsload", function() {
ok( false, "should be cached" );
});
element.tabs( "option", "active", 2 );
start();
}, 1 );
});
element.tabs( "option", "active", 2 );
state( element, 0, 0, 1, 0, 0 );
});
test( "idPrefix", function() {
expect( 1 );

65
ui/jquery.ui.tabs.js vendored
View File

@ -825,7 +825,6 @@ $.widget( "ui.tabs", {
}
},
// TODO: Remove this function in 1.10 when ajaxOptions is removed
_ajaxSettings: function( anchor, event, eventData ) {
var that = this;
return {
@ -862,70 +861,6 @@ if ( $.uiBackCompat !== false ) {
}
});
// TODO: Remove _ajaxSettings() method when removing this extension
// ajaxOptions and cache options
$.widget( "ui.tabs", $.ui.tabs, {
options: {
ajaxOptions: null,
cache: false
},
_create: function() {
this._super();
var that = this;
this._on({ tabsbeforeload: function( event, ui ) {
// tab is already cached
if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) {
event.preventDefault();
return;
}
ui.jqXHR.success(function() {
if ( that.options.cache ) {
$.data( ui.tab[ 0 ], "cache.tabs", true );
}
});
}});
},
_ajaxSettings: function( anchor, event, ui ) {
var ajaxOptions = this.options.ajaxOptions;
return $.extend( {}, ajaxOptions, {
error: function( xhr, status ) {
try {
// Passing index avoid a race condition when this method is
// called after the user has selected another tab.
// Pass the anchor that initiated this request allows
// loadError to manipulate the tab content panel via $(a.hash)
ajaxOptions.error(
xhr, status, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] );
}
catch ( error ) {}
}
}, this._superApply( arguments ) );
},
_setOption: function( key, value ) {
// reset cache if switching from cached to not cached
if ( key === "cache" && value === false ) {
this.anchors.removeData( "cache.tabs" );
}
this._super( key, value );
},
_destroy: function() {
this.anchors.removeData( "cache.tabs" );
this._super();
},
url: function( index ){
this.anchors.eq( index ).removeData( "cache.tabs" );
this._superApply( arguments );
}
});
// abort method
$.widget( "ui.tabs", $.ui.tabs, {
abort: function() {