From 9c8ad4d85739285905494435bfd4b76455a3f98f Mon Sep 17 00:00:00 2001 From: GustavoSept <136198618+GustavoSept@users.noreply.github.com> Date: Tue, 12 Nov 2024 18:09:49 -0300 Subject: [PATCH] fix: increase hash size for autogenerated IDs to reduce collisions - fixes #978 Co-authored-by: Adrian Hesketh --- .version | 2 +- generator/test-css-expression/render_test.go | 4 ++-- generator/test-css-middleware/expected.html | 2 +- generator/test-css-middleware/render_test.go | 2 +- generator/test-css-usage/expected.html | 24 +++++++++---------- .../test-element-attributes/expected.html | 8 +++---- runtime.go | 4 ++-- runtime_test.go | 24 +++++++++++++++++++ 8 files changed, 47 insertions(+), 23 deletions(-) diff --git a/.version b/.version index c9ca53fec..8b99f2a59 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.2.793 \ No newline at end of file +0.2.796 \ No newline at end of file diff --git a/generator/test-css-expression/render_test.go b/generator/test-css-expression/render_test.go index 0214889e1..295b6d8b4 100644 --- a/generator/test-css-expression/render_test.go +++ b/generator/test-css-expression/render_test.go @@ -8,8 +8,8 @@ import ( ) var expected = templ.ComponentCSSClass{ - ID: "className_34fc", - Class: templ.SafeCSS(`.className_34fc{background-color:#ffffff;max-height:calc(100vh - 170px);color:#ff0000;}`), + ID: "className_34fc0328", + Class: templ.SafeCSS(`.className_34fc0328{background-color:#ffffff;max-height:calc(100vh - 170px);color:#ff0000;}`), } func TestCSSExpression(t *testing.T) { diff --git a/generator/test-css-middleware/expected.html b/generator/test-css-middleware/expected.html index 622d4d9ac..df6b148e6 100644 --- a/generator/test-css-middleware/expected.html +++ b/generator/test-css-middleware/expected.html @@ -1,3 +1,3 @@ -
+
Red text
diff --git a/generator/test-css-middleware/render_test.go b/generator/test-css-middleware/render_test.go index cc7f7e4bf..76a86ccb3 100644 --- a/generator/test-css-middleware/render_test.go +++ b/generator/test-css-middleware/render_test.go @@ -16,7 +16,7 @@ import ( //go:embed expected.html var expected string -var expectedCSS = `.red_050e{color:red;} +var expectedCSS = `.red_050e5e03{color:red;} ` func Test(t *testing.T) { diff --git a/generator/test-css-usage/expected.html b/generator/test-css-usage/expected.html index af4ebf684..ff3319393 100644 --- a/generator/test-css-usage/expected.html +++ b/generator/test-css-usage/expected.html @@ -4,33 +4,33 @@ }
Style tags are supported
- -
CSS components are supported
-
Both CSS components and constants are supported
-
Both CSS components and constants are supported
+ +
CSS components are supported
+
Both CSS components and constants are supported
+
Both CSS components and constants are supported
Maps can be used to determine if a class should be added or not.
- -
KV can be used to conditionally set classes.
+ +
KV can be used to conditionally set classes.
Psuedo attributes and complex class names are supported.
Class names are HTML escaped.
-
+
CSS components can be used with arguments.
-
+
CSS components can be used with arguments.
-
+
Rotate
diff --git a/generator/test-element-attributes/expected.html b/generator/test-element-attributes/expected.html index 5a6f04a48..03680c7d1 100644 --- a/generator/test-element-attributes/expected.html +++ b/generator/test-element-attributes/expected.html @@ -1,16 +1,16 @@
Important
-
+
Unimportant
-
+
Else