DOM manipulation no longer allowed during rendering
---------------------------------------------------

                 Key: TAP5-640
                 URL: https://issues.apache.org/jira/browse/TAP5-640
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.1.0.2
            Reporter: Dan Adams


We have a number of utilities that do DOM manipulation while the page is 
rendering. This is often a lot easier than doing it after render and results in 
more concise code. An example is if you have a list of elements:

<ul>
  <li>foo</li>
  <li></li>
  <li></li>
</ul>

After each LI renders, do something like this:

if (element.getChildren().isEmpty())
  element.remove();

It will work for the first empty LI and throw a NPE on the second empty LI 
because the container inside the element is null (which is odd since it just 
rendered into a container). But if you wait till after the LIs have all 
rendered you can loop back and do this safely. However, it's much less readable 
code and is a real bummer.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to