The classes that were being written and thrown away

A sweep for the bug behind the homepage titles found five more of it, because
the mistake is easy and silent: put a class on the tag you write a th:replace
on, and Thymeleaf hands you back the fragment with its own class attribute and
drops yours. Nothing warns, and the page looks nearly right.

  catering  the divider's mt-10, so the branch mark sat on the paragraph above it
  contact   mt-4 under both "Our hours" and "Find us" — the same flush headings
            the homepage had
  footer    mt-4 between the address and the hours under it
  home      text-bakery-800 on the address, which is why "Find us" rendered a
            shade darker (bakery-900, inherited from body) than "Our hours" in
            the panel beside it

Fixed where the fragments already said it should be: "both fragments take the
classes that vary by where they sit". They now take two — the element's own
class as well as the row's or the link's — so the caller has somewhere to put
this that survives. `divider` takes its spacing the same way.

A class on a th:replace tag now has no reason to exist anywhere in the
templates, and there are none left.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
2026-07-26 22:13:05 -05:00
co-authored by Claude Opus 5
parent 5aa2e4589e
commit 68f1ec5961
6 changed files with 17 additions and 15 deletions
@@ -11,16 +11,21 @@
Both fragments take the classes that vary by where they sit — cream in the footer, sage on white in a
card — so the content is shared without the styling being averaged into something that suits neither.
They take TWO classes each, and the outer one is not a convenience. A caller cannot put a class on the
tag it writes the th:replace on: th:replace swaps that whole tag out for the fragment, so the attribute
is dropped and nothing says so. Every call site here had tried it — an mt-4 that never spaced anything,
a text-bakery-800 that left the address a shade darker than the hours beside it.
*/-->
<ul th:fragment="hours(rowClass)" class="space-y-3">
<ul th:fragment="hours(className, rowClass)" th:class="'space-y-3 ' + ${className}">
<li th:each="span : ${hours}" th:class="'flex justify-between gap-4 ' + ${rowClass}">
<span th:text="${span.days}">Tuesday Friday</span>
<span class="font-medium whitespace-nowrap" th:text="${span.hours}">7:00am 2:00pm</span>
</li>
</ul>
<address th:fragment="address(linkClass)" class="not-italic space-y-3">
<address th:fragment="address(className, linkClass)" th:class="'not-italic space-y-3 ' + ${className}">
<p th:text="${shopStreet}">215 E Main Street</p>
<p th:text="${shopTown}">Princeville, IL 61559</p>
<p>