1.1.5 • Published 5 months ago

dom-parser v1.1.5

Weekly downloads
17,083
License
ISC
Repository
github
Last release
5 months ago

dom-parser

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

GitHub Workflow Status (with event) Jest coverage npm GitHub

Installation

npm install dom-parser

Usage

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!

1.1.1

6 months ago

1.0.2

6 months ago

1.1.0

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.1.5

5 months ago

1.0.6

6 months ago

1.1.4

5 months ago

1.0.5

6 months ago

1.1.3

5 months ago

1.0.4

6 months ago

1.1.2

5 months ago

1.0.0-beta

6 months ago

1.0.10

6 months ago

0.1.6

5 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.2

8 years ago

0.0.1

9 years ago

0.2.0

10 years ago