home
features
quick start
download
documentation
thymol files
configuration
message resources
control parameters
expression objects
thymol types
thymol API
thymol extensions
examples
sessions
say-hello
stsm example
with-dialect
extrathyme
petclinic
news
credits
user forum
issues
browser constraints
other known issues
create new issue
thymeleaf

thymoljs

known issues

This page holds information related to known Thmyol issues. Practical work-arounds are provided where possible.

<th:block> and <tbody>

If you use <th:block> in conjunction with prototype-only comment blocks within a <table> element, you may encounter a problem with the resultant html.

When you define a table with no <tbody> elements, the native html parser in most browsers will create <tbody> element(s) for you. A problem can arise because the parser generated <tbody> is usually inserted inside the pre-existing <th:block> and prototype-only comment blocks. As a result, the Thymol output html will probably not be exactly as Thymeleaf would produce it.

Here is an example:

      <table>
	  <!--/*/ <th:block th:each="user : ${users}"> /*/-->
	  <tr>
	      <td th:text="${user.login}">...</td>
	      <td th:text="${user.name}">...</td>
	  </tr>
	  <tr>
	      <td col span="2" th:text="${user.address}">...</td>
	  </tr>
	  <!--/*/ </th:block> /*/-->
      </table>

If we process this block with Thymol and the following thVars:

	var thVars = [
		["user1",		"#{'login' : 'admin', 'name' : 'John Jones', 'address' : 'London'}"],
		["user2",		"#{'login' : 'manager', 'name' : 'Fred Bloggs', 'address' : 'New York'}"],
		["users",		"#[ #user1, #user2 ]"],		
	];

The result is:

	<table>
		<tbody>
			<tr>
				<td>admin</td>
				<td>John Jones</td>
			</tr>
			<tr>
				<td colspan="2">London</td>
			</tr>
		</tbody>
		<tbody>
			<tr>
				<td>manager</td>
				<td>Fred Bloggs</td>
			</tr>
			<tr>
				<td colspan="2">New York</td>
			</tr>
		</tbody>
	</table>

A work-around is to adopt a slightly different template style, if you want to use <th:block> with prototype-only comments then manually define the <tbody> element too:

	<table>
	  <tbody>
	    <!--/*/ <th:block th:each="user : ${users}"> /*/-->
	    <tr>
		<td th:text="${user.login}">...</td>
		<td th:text="${user.name}">...</td>
	    </tr>
	    <tr>
		<td colspan="2" th:text="${user.address}">...</td>
	    </tr>
	    <!--/*/ </th:block> /*/-->
	  </tbody>
	</table>

This results in the following output:

	<table>
		<tbody>
			<tr>
				<td>admin</td>
				<td>John Jones</td>
			</tr>
			<tr>
				<td colspan="2">London</td>
			</tr>
			<tr>
				<td>manager</td>
				<td>Fred Bloggs</td>
			</tr>
			<tr>
				<td colspan="2">New York</td>
			</tr>
		</tbody>
	</table>

Which is exactly what we originally intended.