
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
domparser-rs
Advanced tools
A super fast Node.js addon for HTML parsing and manipulation, written in Rust. It aims to provide a standard-compliant DOM API for Node.js.
DOMParser, querySelector, classList, and more, making it easy to migrate from browser-based code.yarn add domparser-rs
# or
npm install domparser-rs
const { parse } = require('domparser-rs');
const root = parse('<div id="foo" class="bar">hello <span>world</span></div>');
const div = root.select('div');
console.log(div.getAttribute('id')); // "foo"
console.log(div.text()); // "hello world"
div.setAttribute('title', 'my-title');
console.log(div.outerHtml()); // <div id="foo" class="bar" title="my-title">hello <span>world</span></div>
parse(html: string): NodeReprParses an HTML string and returns a NodeRepr instance representing the root node.
DOMParser ClassparseFromString(string: string, mimeType: string): NodeReprParses a string using the specified MIME type (e.g., "text/html").
NodeRepr ClassRepresents a DOM node and provides various manipulation methods.
nodeType: numbernodeName: stringtagName: string | nullnamespaceURI: string | nullprefix: string | nulllocalName: string | nullid: stringclassName: stringparentNode: NodeRepr | nullparentElement: NodeRepr | nullfirstChild: NodeRepr | nulllastChild: NodeRepr | nullpreviousSibling: NodeRepr | nullnextSibling: NodeRepr | nullfirstElementChild: NodeRepr | nulllastElementChild: NodeRepr | nullpreviousElementSibling: NodeRepr | nullnextElementSibling: NodeRepr | nullchildren: NodeRepr[]childElementCount: numbernodeValue: string | nulldata: string | nulltextContent: stringinnerHTML: stringouterHTML: stringownerDocument: NodeRepr | nullchildNodes: NodeRepr[]isConnected: booleandoctype: NodeRepr | nullhead: NodeRepr | nullbody: NodeRepr | nulltitle: stringdocumentElement: NodeRepr | nullappend(newChild: NodeRepr): voidappendChild(newChild: NodeRepr): NodeReprprepend(newChild: NodeRepr): voidafter(newSibling: NodeRepr): voidbefore(newSibling: NodeRepr): voidinsertBefore(newNode: NodeRepr, refNode?: NodeRepr | null): NodeReprreplaceChild(newChild: NodeRepr, oldChild: NodeRepr): NodeReprreplaceWith(newNode: NodeRepr): voidremove(): voidclone(): NodeRepr (Shallow clone)cloneRecursive(): NodeRepr (Deep clone)cloneNode(deep?: boolean): NodeReprimportNode(externalNode: NodeRepr, deep?: boolean): NodeRepradoptNode(externalNode: NodeRepr): NodeReprnormalize(): voidgetAttribute(name: string): string | nullsetAttribute(name: string, value: string): voidremoveAttribute(name: string): voidtoggleAttribute(name: string, force?: boolean): booleanhasAttribute(name: string): booleangetAttributeNames(): string[]getAttributes(): Record<string, string>getAttributeNS(namespace: string | null, localName: string): string | nullsetAttributeNS(namespace: string | null, name: string, value: string): voidremoveAttributeNS(namespace: string | null, localName: string): voidhasAttributeNS(namespace: string | null, localName: string): booleanselect(selectors: string): NodeRepr | nullselectAll(selectors: string): NodeRepr[]querySelector(selectors: string): NodeRepr | nullquerySelectorAll(selectors: string): NodeRepr[]getElementById(id: string): NodeRepr | nullgetElementsByClassName(classNames: string): NodeRepr[]getElementsByTagName(tagName: string): NodeRepr[]matches(selectors: string): booleanclosest(selectors: string): NodeRepr | nullcontains(otherNode: NodeRepr): booleanclassListAdd(className: string): voidclassListRemove(className: string): voidclassListToggle(className: string, force?: boolean): booleanclassListContains(className: string): booleandatasetGet(): Record<string, string>datasetSet(key: string, value: string): voiddatasetRemove(key: string): voidtext(): stringinnerHtml(): stringouterHtml(): stringcreateElement(tagName: string): NodeReprcreateTextNode(data: string): NodeReprcreateComment(data: string): NodeReprcreateDocumentFragment(): NodeReprcreateProcessingInstruction(target: string, data: string): NodeReprisSameNode(otherNode: NodeRepr): booleanisEqualNode(otherNode: NodeRepr): booleancompareDocumentPosition(other: NodeRepr): numberlookupPrefix(namespace?: string): string | nulllookupNamespaceURI(prefix?: string): string | nullisDefaultNamespace(namespace?: string): booleangetRootNode(): NodeReprhasChildNodes(): booleanhasAttributes(): booleansplitText(offset: number): NodeReprsubstringData(offset: number, count: number): stringappendData(data: string): voidinsertData(offset: number, data: string): voiddeleteData(offset: number, count: number): voidreplaceData(offset: number, count: number, data: string): voidinsertAdjacentElement(position: string, element: NodeRepr): NodeRepr | nullinsertAdjacentText(position: string, data: string): voidinsertAdjacentHTML(position: string, html: string): voidnpm install
npm run build
npm test
npm run benchmark
For more usage examples and advanced API, see the source code and benchmarks in the repository.
FAQs
A super fast html parser and manipulator written in rust.
We found that domparser-rs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.