Skip to content

Commit 6327fd3

Browse files
feat(rdom): add support for no-arg fns in child positions
- update `$tree()` to support no-arg functions in child positions
1 parent 4a2f35b commit 6327fd3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/rdom/src/dom.ts

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { isComment, isComponent } from "./checks.js";
3434
* - `[COMMENT, "foo", "bar"...]` (DOM comment node)
3535
* - `[IComponent, ...mountargs]`
3636
* - `[function, ...args]`
37+
* - `["tag", {...attribs}, noArgFunction, "other"]`
3738
* - ES6 iterable of the above (for child values only!)
3839
*
3940
* Any other values will be cast to strings and added as spans to current
@@ -59,6 +60,8 @@ export const $tree = async (
5960
? tree.mount(parent, idx)
6061
: isDeref(tree)
6162
? $tree(tree.deref(), parent)
63+
: isFunction(tree)
64+
? $tree(tree(), parent, idx)
6265
: isNotStringAndIterable(tree)
6366
? $treeIter(tree, parent)
6467
: tree != null

0 commit comments

Comments
 (0)