domify
turn HTML into DOM elements
Last updated 12 years ago by tjholowaychuk .
Original npm · Tarball · package.json
$ gnpm install domify 
SYNC missed versions from official npm registry.

domify

Turn a HTML string into DOM elements, cross-platform

Usage

Works out of the box in the browser:

import domify from 'domify';

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

You can also run it in Node.js and other non-browser environments by passing a custom implementation of document:

import {JSDOM} from 'jsdom';

const jsdom = new JSDOM();

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

Note: For browser-only use, prefer DOMParser.parseFromString().

Current Tags

  • 2.0.0                                ...           latest (a year ago)

16 Versions

  • 2.0.0                                ...           a year ago
  • 1.4.2                                ...           a year ago
  • 1.4.1                                ...           4 years ago
  • 1.4.0                                ...           9 years ago
  • 1.3.3                                ...           10 years ago
  • 1.3.2                                ...           10 years ago
  • 1.3.1                                ...           10 years ago
  • 1.3.0                                ...           10 years ago
  • 1.2.2                                ...           11 years ago
  • 1.2.1                                ...           11 years ago
  • 1.1.1                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
  • 0.2.0                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
  • 0.0.3                                ...           12 years ago
  • 0.0.2                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |