Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-640

DOM manipulation during rendering can NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.1.0.2
    • 5.1.0.4
    • tapestry-core
    • None

    Description

      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.

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            hagios17 Dan Adams
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: