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 2010/03/29 19:33:34 UTC

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

Author: lofwyr
Date: Mon Mar 29 17:33:33 2010
New Revision: 928843

URL: http://svn.apache.org/viewvc?rev=928843&view=rev
Log:
TOBAGO-865: Simplify AJAX component handling

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

Modified: myfaces/tobago/trunk/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/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=928843&r1=928842&r2=928843&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Mon Mar 29 17:33:33 2010
@@ -1085,7 +1085,7 @@ var Tobago = {
     if (div.size() == 0) {
       jQuery("form:first") // add the new div after the page and the popup divs.
           .children("(.tobago-page-default,.tobago-popup-default):last")
-          .after("<div id='" + popupId + "'");
+          .after("<div id='" + popupId + "' />");
     }
 
     Tobago.addAjaxComponent(popupId);
@@ -2356,20 +2356,13 @@ Tobago.Updater = {
 
   doUpdate: function(data) {
     if (data.responseCode == Tobago.Updater.CODE_SUCCESS) {
-      var container = Tobago.ajaxComponents[data.ajaxId];
-      if (container) {
-// TODO: replace the object instead of replace the content, but for that we have to change the renderers.
-        container = Tobago.element(container);
-        container.innerHTML = data.html;
-        try {
-          var updateScript;
-          eval("updateScript = " + data.script);
-          updateScript();
-        } catch (e) {
-          LOG.error(e);
-        }
-      } else {
-        LOG.warn("can't find container to update");
+      jQuery(Tobago.escapeClientId(data.ajaxId)).replaceWith(data.html);
+      try {
+        var updateScript;
+        eval("updateScript = " + data.script);
+        updateScript();
+      } catch (e) {
+        LOG.error(e);
       }
     } else {
       Tobago.deleteOverlay(Tobago.element(Tobago.ajaxComponents[data.ajaxId]));