You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2011/08/10 10:30:26 UTC

svn commit: r1156069 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Author: lofwyr
Date: Wed Aug 10 08:30:25 2011
New Revision: 1156069

URL: http://svn.apache.org/viewvc?rev=1156069&view=rev
Log:
cleanup js

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1156069&r1=1156068&r2=1156069&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Wed Aug 10 08:30:25 2011
@@ -265,8 +265,7 @@ var Tobago = {
 
     this.addBindEventListener(window, 'unload', this, 'onUnload');
 
-    // XXX not nice...
-    xxx_tobagoInit();
+    Tobago.init0();
 
     if (TbgTimer.endBody) { // @DEV_ONLY
       TbgTimer.startAppOnload = new Date(); // @DEV_ONLY
@@ -1691,6 +1690,17 @@ var Tobago = {
   }
 };
 
+// internal initializer will be called in two cases:
+// 1. full load: elements: undefined
+// 2. ajax load: elements: list of the loaded dom elements
+Tobago.init0 = function(elements) {
+  Tobago.Menu.init(elements);
+  Tobago.TabGroup.init(elements);
+  Tobago.Tree.init(elements);
+  Tobago.ToolBar.init(elements);
+  Tobago.fixPngAlphaAll(elements);
+};
+
 Tobago.Config = {
   set: function(name, key, value) {
     if (!this[name]) {
@@ -2487,7 +2497,7 @@ Tobago.Updater = {
             this.afterDoUpdateSuccess();
           }
           if (data.html.length > 0) {
-            xxx_tobagoInit(newElement);
+            Tobago.init0(newElement);
           }
         } catch (e) {
           LOG.error('Error in doUpdate: ' + e); // @DEV_ONLY
@@ -2630,16 +2640,6 @@ Tobago.ToolBar.setRadioValue = function(
   element.value = value;
 };
 
-// XXX write initialization
-
-function xxx_tobagoInit(elements) {
-  Tobago.Menu.init(elements);
-  Tobago.TabGroup.init(elements);
-  Tobago.Tree.init(elements);
-  Tobago.ToolBar.init(elements);
-  Tobago.fixPngAlphaAll(elements);
-}
-
 // inputSuggest.js
 
 Tobago.AutocompleterAjax = function(elementId, required, requiredClass, options) {