Revision: 4235
Author: [email protected]
Date: Tue Aug 10 09:32:00 2010
Log: [?1034hIssue 1237 regression : Fix playground
http://codereview.appspot.com/1960041

The earlier fix to the playground for 1237 broke when a new tab was inserted. This fixes it in a less brittle way.

[email protected]

http://code.google.com/p/google-caja/source/detail?r=4235

Modified:
 /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java

=======================================
--- /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java Fri Aug 6 18:54:18 2010 +++ /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java Tue Aug 10 09:32:00 2010
@@ -405,7 +405,7 @@
     editorPanel.setSize("100%", "100%");
     editorPanel.getDeckPanel().setSize("100%", "100%");

-    editorPanel.selectTab(0);
+    selectTab(Tabs.SOURCE);
     return editorPanel;
   }

@@ -544,18 +544,18 @@
       return;
     }
     renderPanel.setHTML(
-    "<div id=\"cajoled-output\">\n" +
-      html +
-    "</div>\n");
+        "<div id=\"cajoled-output\">\n"
+       + (html != null ? html : "")
+       + "</div>\n");

// Make the cajoled content visible so that the DOM will be laid out before
     // the script checks DOM geometry.
-    editorPanel.selectTab(2);
+    selectTab(Tabs.RENDER);

     Element parent = renderPanel.getElement();
     parent.appendChild(scriptOf(policy));
     parent.appendChild(scriptOf("caja___.enable()"));
-    parent.appendChild(scriptOf(js));
+    if (js != null) { parent.appendChild(scriptOf(js)); }

     renderResult.setText(getRenderResult());
   }

Reply via email to