Projects
View on GitHub
sindresorhus/domify
About
html -> elements
Web & App DevelopmentMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Originaldomify
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().
Explore related projects
Loading…