Odd CustomLayout behaviour... bug?

I’ve been using a CustomLayout tonight and I’ve noticed something a bit weird.

Here’s some test code that I’m running:


    String layout = "<div> Some text.<div location=\"C1\"/> Bug? Text following C1 isn't emitted</div>";
    try
    {
      CustomLayout customLayout = new CustomLayout(new ByteArrayInputStream(layout.getBytes()));
      customLayout.addComponent(new Label("test"), "C1");
      return customLayout;
    }
    catch (IOException e)
    {
      // TODO Auto-generated catch block
      e.printStackTrace();
      return null;
    }

This results in “Some text. test” in the browser, but not the text following the

.

I notice that if I close the div using another tag (ie:

) the following text is emitted. I’m not sure if the browser is relevant at this level, but I’ve tested it in both Safari 4.0.4 and Firefox 3.6.

Is this expected behaviour?

I’m using Vaadin 6.2.4.

I noticed this
Thread
identifying this as a regression.

It’s a little inconvenient as my layout strings are dynamically generated using an XML processor which emits empty tags when appropriate. Fortunately forcing an XML comment in to the div, keeping it open, seems to work around the issue okay =(

I do not think this is a regression or even a bug. [code]

[/code] tag is not valid HTML, it must be [code]
[/code]. Try creating a local file with your HTML code [code]
Some text.
Bug? Text following C1 isn't emitted
[/code] Load it in Firefox and view it using Firebug. Instead of ignoring the invalid HTML Firefox tries to be smart and renders [code]
Some text
Bug? Text following C1 isn't emitted
[/code]Using that HTML obviously the "Bug?..." text will be replaced by the component as it replaces whatever is inside the div with location C1.

Thanks for your reply Artur, but according to the JavaDoc on CustomLayout and the book of vaadin, the template is XHTML =(

Your comment made me think to declare the xml namespace, but that didn’t help either. Perhaps the documentation incorrect?


http://jyte.com/cl/the-self-closing-tag-syntax-is-not-valid-for-all-xhtml-elements