title: PrimeFaces 3.0 - JavaScript error on PPR of <p:tree>
body: <p><em>This question is mainly directed at the PrimeFaces dev team but maybe someone else knows a workaround. I can't upload screenshots on the PrimeFaces support forums but I can link to my question here.</em></p>
  
  <p><em>Posted on PrimeFaces forums here:</em>
  <a href="http://www.primefaces.org/forum/viewtopic.php?f=3&amp;t=14203&amp;sid=5a4e3dad45f2978e9a896fc5fdb17d50" rel="nofollow noreferrer">http://www.primefaces.org/forum/viewtopic.php?f=3&amp;t=14203&amp;sid=5a4e3dad45f2978e9a896fc5fdb17d50</a></p>
  
  <p>I have been encountering JavaScript errors when using the PrimeFaces 3.0 <code>&lt;p:tree&gt;</code> component. I have put together a very simple example to illustrate:</p>
  
  <p>The page containing the tree is rendered successfully the first time.</p>
  
  <p><strong><em>NOTE: The <code>expanded="true"</code> property is being completely ignored, but that's a different problem.</em></strong></p>
  
  <p><img src="https://i.stack.imgur.com/M3iRc.png" alt="initial page draw - OK"></p>
  
  <p>Expand any node on the tree.</p>
  
  <p><img src="https://i.stack.imgur.com/VIJWG.png" alt="node is expanded on tree"></p>
  
  <p>Finally I click on a command button on the page that does nothing except to trigger a Partial Page Render of the <code>&lt;p:tree&gt;</code>. A JavaScript error occurs.</p>
  
  <p><img src="https://i.stack.imgur.com/yu4ZB.png" alt="PPR causes JavaScript error"></p>
  
  <p>The error code text is:</p>
  
  <pre><code>Line: 17
  Char: 5725
  Error: Could not complete the operation due to error 80020101
  Code: 0
  </code></pre>
  
  <p>Here is the relevant code from the Facelet page:</p>
  
  <pre><code>&lt;h:form id="contentForm"&gt;
      &lt;p:outputPanel layout="block"&gt;
          &lt;p:commandButton
                  ajax="true"
                  process="@this"
                  update="treeArea"
                  value="Redraw Tree" /&gt;
      &lt;/p:outputPanel&gt;
  
      &lt;p:outputPanel id="treeArea" layout="block"&gt;
          &lt;p:tree
                  value="#{treeTestBean.trivialTreeRoot}" 
                  var="node" 
                  expanded="true"
                  update="selectedEntityName"&gt;
              &lt;p:treeNode&gt;
                  &lt;h:outputText value="#{node}" /&gt;
              &lt;/p:treeNode&gt;
          &lt;/p:tree&gt;
      &lt;/p:outputPanel&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Here is the relevant code from the bean:</p>
  
  <pre><code>@SuppressWarnings("unused")
  public TreeNode getTrivialTreeRoot() {
      TreeNode root = new DefaultTreeNode("Root", null);
      TreeNode node0 = new DefaultTreeNode("Node 0", root);
      TreeNode node1 = new DefaultTreeNode("Node 1", root);
      TreeNode node2 = new DefaultTreeNode("Node 2", root);
  
      TreeNode node00 = new DefaultTreeNode("Node 00", node0);
      TreeNode node01 = new DefaultTreeNode("Node 01", node0);
  
      TreeNode node010 = new DefaultTreeNode("Node 010", node01);
      return root;
  }
  </code></pre>
  
  <p>I am using the current PrimeFaces 3.0-M3-SNAPSHOT with Mojarra 2.1.1 and Tomcat 7.0.14. Browser is IE 7.</p>
  
  <p><strong>Any idea how I can work around this? It's a showstopper for me since I need a way to display a treeview in my webapp. Once the JavaScript error occurs it makes all the other PrimeFaces components on the page non-responsive.</strong></p>