Skip to content

layout:decorator does not work correclty over multiple layers anymore #130

@Stummi

Description

@Stummi

while upgrading thymeleaf to 3 and thymeleaf-layout-dialect within a spring boot application, I noticed that templates behaves differently with multiple decorator layers. The merging logic also behaves different between 2.0.0 and 2.0.1, but both does not resemble the behavior from 1.4, which I think is a bug.

Heres a simple test case with 3 layout files:
layout1.html:

<!DOCTYPE HTML>
<html>
<head>
  <script src="layout1.js"></script>
</head>
</html>

layout2.html:

<!DOCTYPE HTML>
<html layout:decorator="layout1">
<head>
  <script src="layout2.js"></script>
</head>
</html>

test.html:

<!DOCTYPE HTML>
<html layout:decorator="layout2">
<head>
  <script src="test.js"></script>
</head>
</html>

The result with different combinations of thymeleaf and thymeleaf-layout-dialect versions:

Thymeleaf 2.1.5, Dialect 1.4.0

<!DOCTYPE HTML>

<html>
<head>

<script src="layout1.js"></script>
    <script src="layout2.js"></script>
    <script src="test.js"></script>
</head>
</html>

Thymeleaf 3.0.0, Dialect 2.0.0

<!DOCTYPE HTML>
<html>
<head>

<script src="layout2.js"></script>
<script src="test.js"></script>
</head>
</html>

Thymeleaf 3.0.0, Dialect 2.0.1

<!DOCTYPE HTML>
<html>
<head>

<script src="layout1.js"></script>
<script src="test.js"></script>
</head>
</html>

The behavior also affects the merging of the body part, I just used the head with single script tags for simplicity of the test case.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions