Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-parser

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-parser

Fast dom parser based on regexps

  • 1.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
46K
decreased by-11.66%
Maintainers
1
Weekly downloads
 
Created
Source

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!

Keywords

FAQs

Package last updated on 12 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc