~loges/haitch

555d02e4e8336a837406ce3e58e25e1f80273765 — Logan Connolly a month ago 49c88ed
fix: quiet diagnostic warning with `elif`
2 files changed, 7 insertions(+), 3 deletions(-)

M CHANGELOG.md
M src/haitch/_elements/_element.py
M CHANGELOG.md => CHANGELOG.md +4 -0
@@ 11,6 11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add `unsafe` component for passed unescaped HTML as an element.

### Fixed

- Quiet diagnostic warning by using `elif` control flow.

## 0.8.2 - 2024-03-22

### Changed

M src/haitch/_elements/_element.py => src/haitch/_elements/_element.py +3 -3
@@ 66,13 66,13 @@ class Element:
        if child is None or child is False:
            return ""

        if isinstance(child, str):
        elif isinstance(child, str):
            return child if self._unsafe else html.escape(child)

        if isinstance(child, SupportsHtml):
        elif isinstance(child, SupportsHtml):
            return child._render()

        if isinstance(child, Iterable):
        elif isinstance(child, Iterable):
            return "".join(str(nested_child) for nested_child in child)

        raise ValueError(f"Invalid child type: {type(child)}")