{"id":34540928,"url":"https://github.com/utooland/domparser-rs","last_synced_at":"2026-04-07T07:03:04.300Z","repository":{"id":329119032,"uuid":"1118170323","full_name":"utooland/domparser-rs","owner":"utooland","description":"A super fast, standard-compliant Node.js DOM parser and manipulation library powered by Rust.","archived":false,"fork":false,"pushed_at":"2026-04-07T05:12:56.000Z","size":1569,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-07T05:13:54.902Z","etag":null,"topics":["domparser","napi","node-addon","rust"],"latest_commit_sha":null,"homepage":"https://deepwiki.com/utooland/domparser","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/utooland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-17T11:09:17.000Z","updated_at":"2026-04-07T05:12:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/utooland/domparser-rs","commit_stats":null,"previous_names":["utooland/domparser"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/utooland/domparser-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utooland%2Fdomparser-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utooland%2Fdomparser-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utooland%2Fdomparser-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utooland%2Fdomparser-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/utooland","download_url":"https://codeload.github.com/utooland/domparser-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utooland%2Fdomparser-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31503394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["domparser","napi","node-addon","rust"],"created_at":"2025-12-24T06:16:35.086Z","updated_at":"2026-04-07T07:03:04.294Z","avatar_url":"https://github.com/utooland.png","language":"Rust","readme":"# domparser-rs\n\nA super fast Node.js addon for HTML parsing and manipulation, written in Rust. It provides a standard-compliant DOM API for Node.js, mirroring the browser's built-in `DOMParser`.\n\n## Features\n\n- **Standard Compliant**: Type definitions aligned to `lib.dom.d.ts` — uses `Node`, `Element`, `Document`, `Text`, `Comment`, and other standard DOM interfaces.\n- High-performance DOM parsing and manipulation\n- Exposes a simple JavaScript API via NAPI-RS\n- Designed for both server-side and CLI HTML processing\n- Written in Rust for speed and safety\n\n## Installation\n\n```bash\nyarn add domparser-rs\n# or\nnpm install domparser-rs\n```\n\n## Usage\n\n```js\nconst { DOMParser } = require('domparser-rs');\n\nconst parser = new DOMParser();\nconst doc = parser.parseFromString('\u003cdiv id=\"foo\" class=\"bar\"\u003ehello \u003cspan\u003eworld\u003c/span\u003e\u003c/div\u003e', 'text/html');\n\nconst div = doc.querySelector('div');\nconsole.log(div.getAttribute('id')); // \"foo\"\nconsole.log(div.textContent); // \"hello world\"\ndiv.setAttribute('title', 'my-title');\nconsole.log(div.outerHTML); // \u003cdiv id=\"foo\" class=\"bar\" title=\"my-title\"\u003ehello \u003cspan\u003eworld\u003c/span\u003e\u003c/div\u003e\n```\n\n## API Documentation\n\n### `DOMParser`\n\n```ts\nclass DOMParser {\n  parseFromString(string: string, type: DOMParserSupportedType): Document;\n}\n```\n\nParses a string using the specified MIME type (e.g., `\"text/html\"`) and returns a `Document`.\n\n---\n\n### `Document`\n\nExtends `Node`. Represents the entire HTML document.\n\n#### Properties\n\n| Property | Type | Description |\n|---|---|---|\n| `doctype` | `DocumentType \\| null` | The DTD associated with the document |\n| `documentElement` | `Element \\| null` | The root element (e.g., `\u003chtml\u003e`) |\n| `head` | `Element \\| null` | The `\u003chead\u003e` element |\n| `body` | `Element \\| null` | The `\u003cbody\u003e` element |\n| `title` | `string` | The document title |\n| `children` | `Element[]` | Child elements |\n| `childElementCount` | `number` | Number of child elements |\n| `firstElementChild` | `Element \\| null` | First child element |\n| `lastElementChild` | `Element \\| null` | Last child element |\n\n#### Factory Methods\n\n- `createElement(tagName: string): Element`\n- `createTextNode(data: string): Text`\n- `createComment(data: string): Comment`\n- `createDocumentFragment(): DocumentFragment`\n- `createProcessingInstruction(target: string, data: string): ProcessingInstruction`\n- `importNode\u003cT extends Node\u003e(node: T, deep?: boolean): T`\n- `adoptNode\u003cT extends Node\u003e(node: T): T`\n\n#### Query Methods\n\n- `getElementById(elementId: string): Element | null`\n- `getElementsByClassName(classNames: string): Element[]`\n- `getElementsByTagName(qualifiedName: string): Element[]`\n- `querySelector(selectors: string): Element | null`\n- `querySelectorAll(selectors: string): Element[]`\n- `append(...nodes: (Node | string)[]): void`\n- `prepend(...nodes: (Node | string)[]): void`\n\n---\n\n### `Element`\n\nExtends `Node`. Represents an HTML element.\n\n#### Properties\n\n| Property | Type | Description |\n|---|---|---|\n| `tagName` | `string` | The tag name |\n| `localName` | `string` | The local part of the qualified name |\n| `namespaceURI` | `string \\| null` | The namespace URI |\n| `prefix` | `string \\| null` | The namespace prefix |\n| `id` | `string` | The `id` attribute |\n| `className` | `string` | The `class` attribute |\n| `classList` | `DOMTokenList` | Live token list of class names |\n| `dataset` | `Record\u003cstring, string\u003e` | Data attributes |\n| `innerHTML` | `string` | Inner HTML content |\n| `outerHTML` | `string` | Outer HTML content |\n| `children` | `Element[]` | Child elements |\n| `childElementCount` | `number` | Number of child elements |\n| `firstElementChild` | `Element \\| null` | First child element |\n| `lastElementChild` | `Element \\| null` | Last child element |\n| `previousElementSibling` | `Element \\| null` | Previous sibling element |\n| `nextElementSibling` | `Element \\| null` | Next sibling element |\n\n#### Attribute Methods\n\n- `getAttribute(qualifiedName: string): string | null`\n- `setAttribute(qualifiedName: string, value: string): void`\n- `removeAttribute(qualifiedName: string): void`\n- `toggleAttribute(qualifiedName: string, force?: boolean): boolean`\n- `hasAttribute(qualifiedName: string): boolean`\n- `hasAttributes(): boolean`\n- `getAttributeNames(): string[]`\n- `getAttributeNS(namespace: string | null, localName: string): string | null`\n- `setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void`\n- `removeAttributeNS(namespace: string | null, localName: string): void`\n- `hasAttributeNS(namespace: string | null, localName: string): boolean`\n\n#### Query \u0026 Selection Methods\n\n- `querySelector(selectors: string): Element | null`\n- `querySelectorAll(selectors: string): Element[]`\n- `getElementById(id: string): Element | null`\n- `getElementsByClassName(classNames: string): Element[]`\n- `getElementsByTagName(qualifiedName: string): Element[]`\n- `closest(selectors: string): Element | null`\n- `matches(selectors: string): boolean`\n\n#### Mutation Methods\n\n- `append(...nodes: (Node | string)[]): void`\n- `prepend(...nodes: (Node | string)[]): void`\n- `before(...nodes: (Node | string)[]): void`\n- `after(...nodes: (Node | string)[]): void`\n- `remove(): void`\n- `replaceWith(...nodes: (Node | string)[]): void`\n- `insertAdjacentHTML(position: InsertPosition, html: string): void`\n- `insertAdjacentText(position: InsertPosition, text: string): void`\n- `insertAdjacentElement(position: InsertPosition, element: Element): Element | null`\n\n---\n\n### `Node`\n\nBase interface for all DOM nodes.\n\n#### Properties\n\n| Property | Type | Description |\n|---|---|---|\n| `nodeType` | `number` | The type of the node |\n| `nodeName` | `string` | The name of the node |\n| `nodeValue` | `string \\| null` | The value of the node |\n| `textContent` | `string \\| null` | The text content |\n| `parentNode` | `Node \\| null` | The parent node |\n| `parentElement` | `Element \\| null` | The parent element |\n| `firstChild` | `Node \\| null` | The first child |\n| `lastChild` | `Node \\| null` | The last child |\n| `previousSibling` | `Node \\| null` | The previous sibling |\n| `nextSibling` | `Node \\| null` | The next sibling |\n| `childNodes` | `Node[]` | All child nodes |\n| `ownerDocument` | `Document \\| null` | The owner document |\n\n#### Methods\n\n- `appendChild\u003cT extends Node\u003e(node: T): T`\n- `removeChild\u003cT extends Node\u003e(child: T): T`\n- `insertBefore\u003cT extends Node\u003e(node: T, child: Node | null): T`\n- `replaceChild\u003cT extends Node\u003e(node: Node, child: T): T`\n- `cloneNode(deep?: boolean): Node`\n- `contains(other: Node | null): boolean`\n- `hasChildNodes(): boolean`\n- `getRootNode(): Node`\n- `normalize(): void`\n- `isSameNode(otherNode: Node | null): boolean`\n- `isEqualNode(otherNode: Node | null): boolean`\n- `compareDocumentPosition(other: Node): number`\n- `lookupNamespaceURI(prefix: string | null): string | null`\n- `lookupPrefix(namespace: string | null): string | null`\n- `isDefaultNamespace(namespace: string | null): boolean`\n\n---\n\n### `CharacterData`\n\nExtends `Node`. Base interface for `Text`, `Comment`, and `ProcessingInstruction`.\n\n#### Properties \u0026 Methods\n\n- `data: string`\n- `readonly length: number`\n- `substringData(offset: number, count: number): string`\n- `appendData(data: string): void`\n- `insertData(offset: number, data: string): void`\n- `deleteData(offset: number, count: number): void`\n- `replaceData(offset: number, count: number, data: string): void`\n\n### `Text` extends `CharacterData`\n\n- `splitText(offset: number): Text`\n\n### `Comment` extends `CharacterData`\n\n### `ProcessingInstruction` extends `CharacterData`\n\n- `readonly target: string`\n\n### `DocumentType` extends `Node`\n\n- `readonly name: string`\n- `readonly publicId: string`\n- `readonly systemId: string`\n\n### `DocumentFragment` extends `Node`\n\n- `getElementById(elementId: string): Element | null`\n- `querySelector(selectors: string): Element | null`\n- `querySelectorAll(selectors: string): Element[]`\n\n---\n\n## Contributing\n\n```bash\nnpm install\nnpm run build\nnpm test\n```\n\n## Benchmark\n\n```bash\nnpm run benchmark\n```\n\n---\n\nFor more usage examples and advanced API, see the source code and tests in the repository.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futooland%2Fdomparser-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Futooland%2Fdomparser-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futooland%2Fdomparser-rs/lists"}