diff --git a/src/vhtml.js b/src/vhtml.js index d719228..7f36540 100644 --- a/src/vhtml.js +++ b/src/vhtml.js @@ -15,7 +15,7 @@ export default function h(name, attrs) { // Sortof component support! if (typeof name==='function') { - if (attrs) attrs.children = stack.reverse(); + (attrs || (attrs = {})).children = stack.reverse(); return name(attrs); // return name(attrs, stack.reverse()); } diff --git a/test/vhtml.js b/test/vhtml.js index 4b6adc2..3ca4a31 100644 --- a/test/vhtml.js +++ b/test/vhtml.js @@ -78,6 +78,57 @@ describe('vhtml', () => { ); }); + it('should support sortof components without args', () => { + let items = ['one', 'two']; + + const Item = () => ( +