1.1.2 • Published 5 years ago

html-fragment v1.1.2

Weekly downloads
48
License
MIT
Repository
github
Last release
5 years ago

html-fragment

Convert a string of HTML into a DocumentFragment.

Unlike most other utilities, or general methods that return a fragment from an HTML string, this utility will preserve nodes that require specific parent tags, such as a td element.

Less than 1k gzipped

Install

npm install --save html-fragment

Usage

In the browser

If the library is directly sourced to the window, it operates on the HtmlFragment global variable:

window.HtmlFragment

In ES6

import HtmlFragment from 'html-fragment';

Once you have access to the function, just pass the HTML you want turned into a DocumentFragment into the function.

var fragment = HtmlFragment('<div>Some crazy amount of HTML</div>');

Browser support

ChromeFirefoxSafariIEEdge
9+
1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago