Created
March 20, 2017 08:51
-
-
Save icebeat/a16e9b79ffdbf3c19c165af242c7771b to your computer and use it in GitHub Desktop.
Create dom nodes from html string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createNode = html => new DOMParser().parseFromString(html, "text/html").body.firstChild | |
const example = createNode(` | |
<section> | |
<h1>Hello World</h1> | |
</section> | |
`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment