MCPcopy Index your code
hub / github.com/ershov-konst/dom-parser

github.com/ershov-konst/dom-parser @v1.1.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.5 ↗ · + Follow
47 symbols 113 edges 20 files 0 documented · 0% 2 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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!

Extension points exported contracts — how you extend this code

CompareResult (Interface)
(no doc)
test/types.d.ts
NodeAttributeProps (Interface)
(no doc)
src/lib/NodeAttribute.ts
Matchers (Interface)
(no doc)
test/types.d.ts
NodeProps (Interface)
(no doc)
src/lib/Node.ts

Core symbols most depended-on inside this repo

getElementById
called by 37
src/lib/Dom.ts
parseFromString
called by 36
src/index.ts
getAttribute
called by 21
src/lib/Node.ts
getElementsByTagName
called by 13
src/lib/Dom.ts
find
called by 6
src/lib/Dom.ts
getElementsByClassName
called by 5
src/lib/Dom.ts
toEqualDom
called by 3
test/types.d.ts
getElementsByName
called by 3
src/lib/Dom.ts

Shape

Method 20
Function 14
Class 8
Interface 4
Enum 1

Languages

TypeScript100%

Modules by API surface

src/lib/Node.ts18 symbols
src/lib/Dom.ts17 symbols
test/types.d.ts5 symbols
src/lib/NodeAttribute.ts4 symbols
test/jest-extend.ts2 symbols
src/index.ts1 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add dom-parser \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page