Reviewers: jasvir,

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

Please review this at http://codereview.appspot.com/1960041/show

Affected files:
  M     src/com/google/caja/demos/playground/client/ui/PlaygroundView.java


Index: src/com/google/caja/demos/playground/client/ui/PlaygroundView.java
===================================================================
--- src/com/google/caja/demos/playground/client/ui/PlaygroundView.java (revision 4234) +++ src/com/google/caja/demos/playground/client/ui/PlaygroundView.java (working copy)
@@ -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