diff --git a/djlint/formatter/indent.py b/djlint/formatter/indent.py
index 50355f470..7d3af57de 100644
--- a/djlint/formatter/indent.py
+++ b/djlint/formatter/indent.py
@@ -125,7 +125,7 @@ def fix_handlebars_template_tags(
re.search(
rf"""^(?:[^<\s].*?)? # start of a line, optionally with some text
(?:
- <({slt_html})(?:(?:>|\b[^>]+?>)(?:.*?)(?:(?:\1)>)|\b[^>]*?/>) # stuff or >>> match 1
+ <({slt_html})(?:(?:>|\b[^>]+?>)(?:.*?)(?:(?:\1)>)|\b(?:[^>"']|"[^"]*"|'[^']*')*?\/>) # stuff or
>>> match 1
|(?:<(?:{always_self_closing_html})\b[^>]*?/?>) #
|(?:{{%[ ]*?({slt_template})[ ]+?.*?%}})(?:.*?)(?:{{%[ ]+?end(?:\2)[ ]+?.*?%}}) # >>> match 2
|{config.ignored_inline_blocks}
@@ -133,7 +133,7 @@ def fix_handlebars_template_tags(
(?:
.*? # anything
(?: # followed by another slt
- <({slt_html})(?:(?:>|\b[^>]+?>)(?:.*?)(?:(?:\3)>)|\b[^>]*?/>) # stuff or
>>> match 3
+ <({slt_html})(?:(?:>|\b[^>]+?>)(?:.*?)(?:(?:\3)>)|\b(?:[^>"']|"[^"]*"|'[^']*')*?\/>) # stuff or
>>> match 3
|(?:<(?:{always_self_closing_html})\b[^>]*?/?>) #
|(?:{{%[ ]*?({slt_template})[ ]+?.*?%}})(?:.*?)(?:{{%[ ]+?end(?:\4)[ ]+?.*?%}}) # >>> match 4
|{config.ignored_inline_blocks}
diff --git a/tests/test_html/test_hyperscript.py b/tests/test_html/test_hyperscript.py
new file mode 100644
index 000000000..d80c8a946
--- /dev/null
+++ b/tests/test_html/test_hyperscript.py
@@ -0,0 +1,42 @@
+"""Test for _hyperscript.
+
+uv run pytest tests/test_html/test_hyperscript.py
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+import pytest
+
+from djlint.reformat import formatter
+from tests.conftest import printer
+
+if TYPE_CHECKING:
+ from djlint.settings import Config
+
+test_data = [
+ pytest.param(
+ (
+ "