{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/vue/issues/5870","repository_url":"https://api.github.com/repos/vuejs/vue","labels_url":"https://api.github.com/repos/vuejs/vue/issues/5870/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue/issues/5870/comments","events_url":"https://api.github.com/repos/vuejs/vue/issues/5870/events","html_url":"https://github.com/vuejs/vue/issues/5870","id":235434844,"number":5870,"title":"Expose createTextVNode() 's functionality in the API","user":{"login":"green-coder","id":598193,"avatar_url":"https://avatars2.githubusercontent.com/u/598193?v=3","gravatar_id":"","url":"https://api.github.com/users/green-coder","html_url":"https://github.com/green-coder","followers_url":"https://api.github.com/users/green-coder/followers","following_url":"https://api.github.com/users/green-coder/following{/other_user}","gists_url":"https://api.github.com/users/green-coder/gists{/gist_id}","starred_url":"https://api.github.com/users/green-coder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/green-coder/subscriptions","organizations_url":"https://api.github.com/users/green-coder/orgs","repos_url":"https://api.github.com/users/green-coder/repos","events_url":"https://api.github.com/users/green-coder/events{/privacy}","received_events_url":"https://api.github.com/users/green-coder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-13T04:48:23Z","updated_at":"2017-06-13T04:54:51Z","closed_at":null,"body":"### What problem does this feature solve?\r\nIn the Vue Component's `render()` function, there is no normal way to create a VNode which represents naked text, same as what `createTextVNode()` would create.\r\n\r\nThis is needed when we want to generate things like:\r\n```\r\n<div>\r\n  Hello <strong>Vue</strong>'s world.\r\n</div>\r\n```\r\n\r\n\r\n### What does the proposed API look like?\r\nI propose to change the API in one of those 2 ways:\r\n\r\n1. Add a behavior to the `h` function which is given to the user in the `render()` function so that it can be used for creating a 'text VNode', and document it. I propose to use the null or undefined on the first parameter.\r\n\r\n2. Expose the `createTextVNode()` function (and why not also `VNode()`) somewhere inside Vue.\r\n\r\n<!-- generated by vue-issues. DO NOT REMOVE -->"},"comment":{"url":"https://api.github.com/repos/vuejs/vue/issues/comments/308006545","html_url":"https://github.com/vuejs/vue/issues/5870#issuecomment-308006545","issue_url":"https://api.github.com/repos/vuejs/vue/issues/5870","id":308006545,"user":{"login":"green-coder","id":598193,"avatar_url":"https://avatars2.githubusercontent.com/u/598193?v=3","gravatar_id":"","url":"https://api.github.com/users/green-coder","html_url":"https://github.com/green-coder","followers_url":"https://api.github.com/users/green-coder/followers","following_url":"https://api.github.com/users/green-coder/following{/other_user}","gists_url":"https://api.github.com/users/green-coder/gists{/gist_id}","starred_url":"https://api.github.com/users/green-coder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/green-coder/subscriptions","organizations_url":"https://api.github.com/users/green-coder/orgs","repos_url":"https://api.github.com/users/green-coder/repos","events_url":"https://api.github.com/users/green-coder/events{/privacy}","received_events_url":"https://api.github.com/users/green-coder/received_events","type":"User","site_admin":false},"created_at":"2017-06-13T04:54:51Z","updated_at":"2017-06-13T04:54:51Z","body":"Known 'hacky' workarounds:\r\n\r\n1. Use a non-documented compiler method\r\n\r\n```\r\nrender (h) {\r\n  return this._v(val)\r\n}\r\n```\r\n\r\n2. Use a poorly-documented method behavior's partial result.\r\n\r\n```\r\nrender (h) {\r\n  return h('p', val).children[0] // Works, but wastes CPU.\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"green-coder"}}