From 95a8b0f3ad414587b31934c25072409e4dff9065 Mon Sep 17 00:00:00 2001 From: Esko Luontola Date: Fri, 1 Dec 2023 16:23:55 +0200 Subject: [PATCH] Refactor: avoid an unnecessary runtime check in some situations --- src/hiccup/compiler.clj | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hiccup/compiler.clj b/src/hiccup/compiler.clj index a5bb1e7..ef06242 100644 --- a/src/hiccup/compiler.clj +++ b/src/hiccup/compiler.clj @@ -346,11 +346,12 @@ ~(end-tag))) (build-string ~(str "<" tag (render-attr-map tag-attrs) ">") ~@(compile-seq [attrs-sym]))) - ;; content and ending tag (when the above code did not emit an ending tag) - (when (or ~(boolean (container-tag? tag content)) - (not (map? ~attrs-sym))) - (build-string ~@(compile-seq content) - ~(str ""))))))) + ~@(compile-seq content) + ;; ending tag, when the above code did not emit an ending tag + ~(if (container-tag? tag content) + (str "") + `(when-not (map? ~attrs-sym) + ~(str ""))))))) (defmethod compile-element :default [element]