From: Scott González Date: Thu, 25 Oct 2012 09:27:33 +0000 (-0400) Subject: Tabs: Removed ajaxOptions and cache options. Fixes #7147 - Tabs: Remove ajaxOptions... X-Git-Tag: 1.10.0-beta.1~265 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=52a184e31c0ca5618e6d4873625bf3b7716944b3;p=jquery-ui.git Tabs: Removed ajaxOptions and cache options. Fixes #7147 - Tabs: Remove ajaxOptions and cache options. --- diff --git a/tests/unit/tabs/tabs_common_deprecated.js b/tests/unit/tabs/tabs_common_deprecated.js index 5b41014da..040e8cbf2 100644 --- a/tests/unit/tabs/tabs_common_deprecated.js +++ b/tests/unit/tabs/tabs_common_deprecated.js @@ -1,8 +1,6 @@ TestHelpers.commonWidgetTests( "tabs", { defaults: { active: null, - ajaxOptions: null, - cache: false, collapsible: false, cookie: null, disabled: false, diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js index 297a4546e..b3db097b9 100644 --- a/tests/unit/tabs/tabs_deprecated.js +++ b/tests/unit/tabs/tabs_deprecated.js @@ -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 ); diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 0d920c3a1..77dad0892 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -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() {