Skip to content

📑 Isomorphic library to safely parse an HTML string into DOM tree

License

Notifications You must be signed in to change notification settings

jacobbuck/dom-parse

Repository files navigation

dom-parse

Parse a string of HTML or XML (including MathML, SVG, XHTML) into a document object.

Uses the HTML template element in browsers and jsdom in Node.js.

Usage

import { parse } from 'dom-parse';

parse(string);

Parameters

  • string String containing HTML or XML to parse.

Return value

DocumentFragment Object containing Node structure of HTML/XML parsed.

Example

import { parse } from 'dom-parse';

parse('Some <em>awesome</em> markup <img src="explosion.gif">');
// returns DocumentFragment(4) [ #text, em, #text, img ]

About

📑 Isomorphic library to safely parse an HTML string into DOM tree

Resources

License

Stars

Watchers

Forks