Return itself when the html element is expanded
This commit is contained in:
parent
dbe249fbd8
commit
988aa8d672
1 changed files with 9 additions and 7 deletions
|
@ -21,6 +21,15 @@
|
||||||
(and children
|
(and children
|
||||||
(list :children (flatten children))))))
|
(list :children (flatten children))))))
|
||||||
|
|
||||||
|
(defmethod expand ((elm element))
|
||||||
|
(with-accessors ((kind element-kind)
|
||||||
|
(props element-props)) elm
|
||||||
|
(if (functionp kind)
|
||||||
|
(apply kind props)
|
||||||
|
elm)))
|
||||||
|
|
||||||
|
;;;; utils
|
||||||
|
|
||||||
(defun flatten (x)
|
(defun flatten (x)
|
||||||
(labels ((rec (x acc)
|
(labels ((rec (x acc)
|
||||||
(cond ((null x) acc)
|
(cond ((null x) acc)
|
||||||
|
@ -29,10 +38,3 @@
|
||||||
(car x)
|
(car x)
|
||||||
(rec (cdr x) acc))))))
|
(rec (cdr x) acc))))))
|
||||||
(rec x nil)))
|
(rec x nil)))
|
||||||
|
|
||||||
(defmethod expand ((elm element))
|
|
||||||
(with-accessors ((kind element-kind)
|
|
||||||
(props element-props)) elm
|
|
||||||
(if (functionp kind)
|
|
||||||
(apply kind props)
|
|
||||||
(error "element-kind is not a function."))))
|
|
||||||
|
|
Loading…
Reference in a new issue