# dom-parser

> Fast dom parser based on regexps

Latest version **1.1.5** (published 2023-11-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install dom-parser
pnpm add dom-parser
yarn add dom-parser
bun add dom-parser
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2023-11-12 |
| First published | 2015-10-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Konstantin Ershov |
| Maintainers | ershov-konst |
| Keywords | domparser, dom, parser, xml, html, xmlparser, htmlparser, scraping |

## Links

- npm: https://www.npmjs.com/package/dom-parser
- Repository: https://github.com/ershov-konst/dom-parser
- Homepage: https://github.com/ershov-konst/dom-parser#readme
- Issues: https://github.com/ershov-konst/dom-parser/issues
- npm.io page: https://npm.io/package/dom-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.5 (latest) — 2023-11-12
- 1.1.4 — 2023-11-12
- 1.1.3 — 2023-11-12
- 1.1.2 — 2023-11-08
- 1.1.1 — 2023-11-07
- 1.1.0 — 2023-11-07
- 1.0.10 — 2023-11-06
- 1.0.9 — 2023-11-06
- 1.0.8 — 2023-11-06
- 1.0.7 — 2023-11-06
- 1.0.6 — 2023-11-06
- 1.0.5 — 2023-11-06
- 1.0.4 — 2023-11-06
- 1.0.2 — 2023-11-06
- 1.0.0-beta — 2023-11-06
- … 9 more at https://npm.io/package/dom-parser/versions

## README

# dom-parser

Fast, tiny, zero-dependency DOM parser based on RegExps

![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/ershov-konst/dom-parser/bump-build-release.yml)
![Jest coverage](./badges/coverage-jest%20coverage.svg)
![npm](https://img.shields.io/npm/dw/dom-parser)
![GitHub](https://img.shields.io/github/license/ershov-konst/dom-parser)


## Installation

    npm install dom-parser

## Usage
```typescript
import { parseFromString } from 'dom-parser';

const html = await fs.readFileAsync('htmlToParse.html');

// Getting DOM model
const dom = parseFromString(html);

// Searching Nodes
const rootNode = dom.getElementById('rootNode');
const childNodes = rootNode.getElementsByClassName('childNodeClass');

```

## API

### Dom

#### Implemented methods

* getElementById
* getElementsByClassName
* getElementsByTagName
* getElementsByName

### Node

#### Implemented properties

* nodeType
* nodeName
* childNodes
* firstChild
* lastChild
* parentNode
* attributes
* innerHTML
* outerHTML
* textContent

#### Implemented methods

* getAttribute
* getElementById
* getElementsByClassName
* getElementsByTagName
* getElementsByName

Usage - https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement


## Contributing

Issues and pull requests are welcome!

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