Skip to content

Commit 8236c66

Browse files
Fix broken rendering of self-closing tags
1 parent 7d8d94f commit 8236c66

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pyhtml/__tag_base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,14 @@ def _render(self) -> list[str]:
158158
Renders tag and its children to a list of strings where each string is
159159
a single line of output
160160
"""
161-
if len(self.attributes):
161+
attributes = util.filter_attributes(util.dict_union(
162+
self._get_default_attributes(),
163+
self.attributes,
164+
))
165+
if len(attributes):
162166
return [
163167
f"<{self._get_tag_name()} "
164-
f"{util.render_tag_attributes(self.attributes)}/>"
168+
f"{util.render_tag_attributes(attributes)}/>"
165169
]
166170
else:
167171
return [f"<{self._get_tag_name()}/>"]

0 commit comments

Comments
 (0)