# dom-insert-html

> HTML string DOM insertion methods.

Latest version **0.1.0** (published 2014-12-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install dom-insert-html
pnpm add dom-insert-html
yarn add dom-insert-html
bun add dom-insert-html
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-12-27 |
| First published | 2014-12-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Nicolas Gallagher |
| Maintainers | necolas |
| Keywords | browser, dom, html, string, insertion |

## Links

- npm: https://www.npmjs.com/package/dom-insert-html
- Repository: https://github.com/necolas/dom-insert-html
- Issues: https://github.com/necolas/dom-insert-html/issues
- npm.io page: https://npm.io/package/dom-insert-html

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-12-27

## README

# dom-insert-html

[![Build Status](https://secure.travis-ci.org/necolas/dom-insert-html.png?branch=master)](http://travis-ci.org/necolas/dom-insert-html)

HTML-string DOM insertion methods. Convenient, minifier-friendly methods for
using [insertAdjacentHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element.insertAdjacentHTML).

## Installation

```
npm install dom-insert-html
```

## API

Available methods:

* `after(element, string)`: insert HTML string after element.
* `before(element, string)`: insert HTML string before element.
* `append(element, string)`: append HTML string to element.
* `prepend(element, string)`: prepend HTML string to element.

Each method accepts:

* `element` {Element}: DOM element
* `string` {String}: the HTML stringn to insert.

## Examples

```js
var html = require('dom-insert-html');
var el = document.querySelector('.element');
var str = '<p>DOMString content</p>';

html.after(el, str);
html.before(el, str);
html.append(el, str);
html.prepend(el, str);
```

## Browser support

* Google Chrome
* Firefox 8+
* Internet Explorer 4+
* Safari 4+
* Opera 7+

---
_Source: https://npm.io/package/dom-insert-html · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
