xmlet/HtmlFlow

Tags gets confused with text

Closed this issue · 2 comments

This code, produces this nice output:
form
  .textarea()
   .addAttr("align", "right")
   .attrRows(50l)
   .attrCols(50l)
   .attrId("id")
   .attrName("name")
   .attrStyle(style)
   .text("text")
  .__();

<textarea align="right" rows="50" cols="50" id="id" name="name" style="width: 89%; height: 77px;">

However, this code, produces a problematic output:
form
 .textarea()
   .addAttr("align", "right")
   .attrRows(50l)
   .text("text")
   .attrCols(50l)
   .attrId("id")
   .attrName("name")
   .attrStyle(style)
  .__();
<textarea align="right" rows="50">text cols="50" id="id" name="name" style="width: 89%; height: 77px;"

All I did was move the .text("text") up, and it made it outside of the textarea tag.
It happened with other properties like attrClass.
If it happens because text returns the parent element, maybe an exception should be thrown if I use attr after.

Good catch !!!

And you are right about: maybe an exception should be thrown if I use attr after.

I will fix it according.

Thanks,
Miguel

Solved on new release 4.2, following your suggestion of throwing an Exception on that case.