What do you think about the following patch?

--- tabs.js     (revision 631674)
+++ tabs.js     (working copy)
@@ -190,11 +190,6 @@
  * @return {String} DOM id of the tab container.
  */
 gadgets.TabSet.prototype.addTab = function(tabName, opt_params) {
-  // Legacy support
-  if (typeof opt_params === 'string') {
-    opt_params = {contentContainer: arguments[1], callback: arguments[2]};
-  }
-
   var params = opt_params || {};

   var tabIndex = -1;
@@ -639,3 +634,14 @@
   return this.addTab(tabName, {callback: callback});
 };

+(function(){
+  var addTab_ = _IG_Tabs.prototype.addTab;
+  _IG_Tabs.prototype.addTab = function(tabName) {
+    if (typeof arguments[1] === 'string') {
+      addTab_.call(this, tabName,
+                   {contentContainer: arguments[1], callback: arguments[2]});
+    } else {
+      addTab_.apply(this, arguments);
+    }
+  };
+})();


On Wed, Feb 27, 2008 at 11:54 AM, Cassie <[EMAIL PROTECTED]> wrote:
> On Wed, Feb 27, 2008 at 10:46 AM, <[EMAIL PROTECTED]> wrote:
>
>  > Author: zhen
>  > Date: Wed Feb 27 10:46:10 2008
>  > New Revision: 631674
>  >
>  > URL: http://svn.apache.org/viewvc?rev=631674&view=rev
>  > Log:
>  > Legacy support for _IG_Tabs.prototype.addTab(tabName, opt_domId,
>  > opt_callback).
>  >
>  >
>  > Modified:
>  >    incubator/shindig/trunk/features/tabs/tabs.js
>  >
>  > Modified: incubator/shindig/trunk/features/tabs/tabs.js
>  > URL:
>  > 
> http://svn.apache.org/viewvc/incubator/shindig/trunk/features/tabs/tabs.js?rev=631674&r1=631673&r2=631674&view=diff
>  >
>  > 
> ==============================================================================
>  > --- incubator/shindig/trunk/features/tabs/tabs.js (original)
>  > +++ incubator/shindig/trunk/features/tabs/tabs.js Wed Feb 27 10:46:10 2008
>  > @@ -190,6 +190,11 @@
>  >  * @return {String} DOM id of the tab container.
>  >  */
>  >  gadgets.TabSet.prototype.addTab = function(tabName, opt_params) {
>
>
>  It would be great if we could move this change into the legacy only version
>  because it isn't documented in the spec. It looks like we already do that
>  with addDynamic tab, so something like
>
>  newAddTabFunction = _IG_Tabs.prototype.addTab
>
>  _IG_Tabs.prototype.addTab = function(tabName, callback) {
>   // legacy translation code you wrote
>   return newTabFunction(...);
>  };
>
>  What do you think?
>
>
>
>
>  > +  // Legacy support
>  > +  if (typeof opt_params === 'string') {
>  > +    opt_params = {contentContainer: arguments[1], callback:
>  > arguments[2]};
>  > +  }
>  > +
>  >   var params = opt_params || {};
>  >
>  >   var tabIndex = -1;
>  >
>  >
>  >
>

Reply via email to