string-to-dom
Add a string of HTML to the DOM and return the new HTML element.
Uses insertAdjacentHTML
to add a given string to the DOM in an efficient manner and return the newly created HTML element.
Useful in test suites for setting up HTML to assert against.
Install
npm install --save string-to-dom
Usage
var stringToDom = ; // Add the <p> tag to the page (right after the <body> tag).// `message` is the newly created HTML element.var message = ; // Optionally add to a particular node on the page:var target = documentvar button =
API
See the API docs for full documentation.