You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Luke Childs a291bb6599 Add LICENSE file 8 years ago
src Add function 9 years ago
test Update node-browser-environment with browser-env 8 years ago
.gitignore add .nyc_output to .gitignore 9 years ago
.npmignore Add .npmignore to fix npm issue 9 years ago
.travis.yml Don't send email on success 8 years ago
LICENSE Add LICENSE file 8 years ago
README.md Recommend node-browser-environment in readme 8 years ago
package.json Update node-browser-environment with browser-env 8 years ago

README.md

create-node Build Status Coverage Status

Converts an HTML string to a DOM node.

Important note

This module is intended for use in the browser and therefore requires a JS environment that implements the DOM. If you want to use it with node you'll also need node-browser-environment or some other browser environment polyfill.

Install

npm install --save create-node

or

jspm install create-node

Usage

import createNode from 'create-node';

const markup = `
<div>
  <span>hello</span>
  <span>world</span>
</div>`;

const node = createNode(markup);
// HTMLDivElement

node.querySelector('span:last-child').textContent;
// 'world'

document.body.appendChild(node);

License

MIT © Luke Childs