From 943348fe1624d8bdd17c499a3f3ec214d6ca338c Mon Sep 17 00:00:00 2001 From: Taco de Wolff Date: Mon, 13 May 2024 17:09:50 -0400 Subject: [PATCH] HTML: don't skip text with templates in select tag, fixes #698 --- html/html.go | 2 +- html/html_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/html/html.go b/html/html.go index ab50ff650b..aa078ef123 100644 --- a/html/html.go +++ b/html/html.go @@ -515,7 +515,7 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st // skip text in select and optgroup tags if t.Hash == Select || t.Hash == Optgroup { - if next := tb.Peek(0); next.TokenType == html.TextToken { + if next := tb.Peek(0); next.TokenType == html.TextToken && !next.HasTemplate { tb.Shift() } } diff --git a/html/html_test.go b/html/html_test.go index 31c9a8a514..213b3d034f 100644 --- a/html/html_test.go +++ b/html/html_test.go @@ -373,6 +373,7 @@ func TestHTMLTemplates(t *testing.T) { {`
`, `
`}, {``, ``}, {`