Paul Stanton created TAP5-2000:
----------------------------------

             Summary: empty element causes 'unbalanced elements' exception
                 Key: TAP5-2000
                 URL: https://issues.apache.org/jira/browse/TAP5-2000
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.3.3
            Reporter: Paul Stanton


consider the following TML markup:
<col t:type="if" t:test="myTest"></col>

If 'myTest' is true, I want to render an empty <col> element, if it is false 
render nothing.

TRUE: [<col></col>]
FALSE: []

however the above markup causes this exception:

Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Component 
MyPage:mycomponent.if_4 has rendered unbalanced elements; either it has started 
an element with MarkupWriter.element() and not followed up with 
MarkupWriter.end(), or it has invoked MarkupWriter.end() without first invoking 
MarkupWriter.element(). [at classpath:com/me/components/MyComponent.tml, line 
26]
        at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$PostRenderCleanupPhase.render(ComponentPageElementImpl.java:441)
        at 
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
        ... 81 more

To work around, include any character (space) within the element:
<col t:type="if" t:test="myTest"> </col>

which renders:
TRUE: [<col> </col>]
FALSE: []

I also imagine you could do:
<t:if test="myTest"><col></col></t:if>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to