thymeleaf / thymeleaf-extras-conditionalcomments

Thymeleaf "extras" dialect for correctly processing IE conditional comments (for Thymeleaf 2.x)
https://www.thymeleaf.org
Apache License 2.0
20 stars 6 forks source link

Conditional comments are not parsed in fragments #2

Closed jashaj closed 10 years ago

jashaj commented 10 years ago

If the conditional comment is inside a fragment of another file, it is not parsed (version 2.1.0.RELEASE).

test.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head th:replace="testincludes.html :: head"></head>
<body>
<h1>Includes work!</h1>
</body>
</html>

testincludes.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head th:fragment="head">
  <title>Testing conditional comments with a fragment</title>
  <meta charset="UTF-8"/>
  <link rel="stylesheet" type="text/css" media="all" href="../static-css/style1.css" th:href="@{http://localhost/css/style1.css}" />
  <!--[if lt IE 8]>
  <link rel="stylesheet" href="../static-css/styleIE67.css" th:href="@{http://localhost/css/styleIE67.css}" type="text/css" media="screen, projection" />
  <![endif]-->
  <link rel="stylesheet" type="text/css" media="all" href="../static-css/style2.css" th:href="@{http://localhost/css/style2.css}" />
</head>
<body>

</body>
</html>

Result:

<!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
  <title>Testing conditional comments with a fragment</title>
  <meta charset="UTF-8" />
  <link rel="stylesheet" type="text/css" media="all" href="http://localhost/css/style1.css" />
  <!--[if lt IE 8]>
  <link rel="stylesheet" href="../static-css/styleIE67.css" th:href="@{http://localhost/css/styleIE67.css}" type="text/css" media="screen, projection" />
  <![endif]-->
  <link rel="stylesheet" type="text/css" media="all" href="http://localhost/css/style2.css" />
</head>
    <body>
    <h1>Includes work!</h1>
    </body>
</html>
ultraq commented 10 years ago

I think this one was fixed in https://github.com/thymeleaf/thymeleaf/issues/236 which is part of the upcoming 2.1.1 release. @danielfernandez can you confirm?

danielfernandez commented 10 years ago

Exactly, confirmed. Closing this one :-)

jashaj commented 10 years ago

It works in 2.1.1, thanks!