Skip to content

Commit d203c70

Browse files
committed
Apply render-children to fragment
1 parent f770e37 commit d203c70

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/element.lisp

+16-16
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@
9696
(with-slots (type props) element
9797
(format stream "<~a~a>" (string-downcase type) (render-props props))))
9898

99+
(defmethod print-object ((element html-tag) stream)
100+
(format stream "<!DOCTYPE html>~%")
101+
(call-next-method))
102+
103+
(defmethod print-object ((element fragment) stream)
104+
(with-slots (children) element
105+
(if children
106+
(format stream
107+
(if (rest children)
108+
"~<~@{~a~^~:@_~}~:>"
109+
"~<~a~:>")
110+
(render-children element)))))
111+
112+
(defmethod print-object ((element component) stream)
113+
(print-object (expand-component element) stream))
114+
99115
(defun render-props (props)
100116
(with-output-to-string (stream)
101117
(loop
@@ -120,22 +136,6 @@
120136
(defmethod render-children ((element non-escaping-tag))
121137
(element-children element))
122138

123-
(defmethod print-object ((element html-tag) stream)
124-
(format stream "<!DOCTYPE html>~%")
125-
(call-next-method))
126-
127-
(defmethod print-object ((element fragment) stream)
128-
(with-slots (children) element
129-
(if children
130-
(format stream
131-
(if (rest children)
132-
"~<~@{~a~^~:@_~}~:>"
133-
"~<~a~:>")
134-
children))))
135-
136-
(defmethod print-object ((element component) stream)
137-
(print-object (expand-component element) stream))
138-
139139
(defmethod expand-component ((element component))
140140
(with-slots (type props children) element
141141
(apply type (merge-children-into-props props children))))

0 commit comments

Comments
 (0)