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 d2f85a4abc Replace test helper with node-browser-environment 9 years ago
src Add function 9 years ago
test Replace test helper with node-browser-environment 9 years ago
.gitignore add .nyc_output to .gitignore 9 years ago
.npmignore Add .npmignore to fix npm issue 9 years ago
.travis.yml Integrate with Travis 9 years ago
README.md Update readme to install from jspm registry 9 years ago
package.json Replace test helper with node-browser-environment 9 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 jsdom or some other DOM implementation.

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