{"action":"created","issue":{"url":"https://api.github.com/repos/dominictarr/hyperscript/issues/37","labels_url":"https://api.github.com/repos/dominictarr/hyperscript/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/dominictarr/hyperscript/issues/37/comments","events_url":"https://api.github.com/repos/dominictarr/hyperscript/issues/37/events","html_url":"https://github.com/dominictarr/hyperscript/issues/37","id":107175075,"number":37,"title":"Return DocumentFragment when called w/o a tag?","user":{"login":"tomekwi","id":4624660,"avatar_url":"https://avatars.githubusercontent.com/u/4624660?v=3","gravatar_id":"","url":"https://api.github.com/users/tomekwi","html_url":"https://github.com/tomekwi","followers_url":"https://api.github.com/users/tomekwi/followers","following_url":"https://api.github.com/users/tomekwi/following{/other_user}","gists_url":"https://api.github.com/users/tomekwi/gists{/gist_id}","starred_url":"https://api.github.com/users/tomekwi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomekwi/subscriptions","organizations_url":"https://api.github.com/users/tomekwi/orgs","repos_url":"https://api.github.com/users/tomekwi/repos","events_url":"https://api.github.com/users/tomekwi/events{/privacy}","received_events_url":"https://api.github.com/users/tomekwi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-18T10:14:27Z","updated_at":"2015-09-19T08:47:33Z","closed_at":null,"body":"I use `DocumentFragment`s quite often when constructing DOM programmatically. And compare these three pieces – the first two are my current options, the third is what I propose:\r\n\r\n```js\r\n//» `<div>` soup.\r\nh('div', [\r\n  h('.abc'),\r\n  h('.def'),\r\n]);\r\n```\r\n\r\n```js\r\n//» Dreadful DOM spaghetti code. Bleeh…\r\nconst fragment = document.createDocumentFragment();\r\nfragment.appendChild(h('.abc'));\r\nfragment.appendChild(h('.def'));\r\n```\r\n\r\n```js\r\n//» How refreshing!\r\nh([\r\n  h('.abc'),\r\n  h('.def'),\r\n]);\r\n```"},"comment":{"url":"https://api.github.com/repos/dominictarr/hyperscript/issues/comments/141636381","html_url":"https://github.com/dominictarr/hyperscript/issues/37#issuecomment-141636381","issue_url":"https://api.github.com/repos/dominictarr/hyperscript/issues/37","id":141636381,"user":{"login":"tomekwi","id":4624660,"avatar_url":"https://avatars.githubusercontent.com/u/4624660?v=3","gravatar_id":"","url":"https://api.github.com/users/tomekwi","html_url":"https://github.com/tomekwi","followers_url":"https://api.github.com/users/tomekwi/followers","following_url":"https://api.github.com/users/tomekwi/following{/other_user}","gists_url":"https://api.github.com/users/tomekwi/gists{/gist_id}","starred_url":"https://api.github.com/users/tomekwi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomekwi/subscriptions","organizations_url":"https://api.github.com/users/tomekwi/orgs","repos_url":"https://api.github.com/users/tomekwi/repos","events_url":"https://api.github.com/users/tomekwi/events{/privacy}","received_events_url":"https://api.github.com/users/tomekwi/received_events","type":"User","site_admin":false},"created_at":"2015-09-19T08:47:33Z","updated_at":"2015-09-19T08:47:33Z","body":"> but maybe that is bad because it's mutating\r\n\r\nUsing, designing and documenting APIs I learned that it’s good when one function returns a value *or* mutates things. But not both at the same time."}}