Skip to content

component/domify

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

domify

Turn HTML into DOM elements x-browser.

Usage

Works out of the box in the browser:

var domify = require('domify');

document.addEventListener('DOMContentLoaded', function() {
  var el = domify('<p>Hello <em>there</em></p>');
  document.body.appendChild(el);
});

You can also run it in node and iojs. Just pass a custom implementation of document:

var jsdom = require('jsdom').jsdom();

domify('<p>Hello <em>there</em></p>', jsdom.defaultView.document);

Running tests

$ npm test

License

MIT