
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
parse5-utilities
Advanced tools
Low-level parse5 node manipulation utilities. ESM-compatible version of parse5-utils.
Low-level parse5 node manipulation utilities.
Parse an HTML string. If
smartis true, returns adocumentordocumentFragmentbased on the input. Otherwise, always parses it as a document.
parse(html: string, smart?: boolean): Document | DocumentFragment
Parses HTML as a fragment.
createFragment(html: string): DocumentFragment
Converts an AST node into an HTML string.
stringify(node: Node): string
Get the attributes of a node as an object.
attributesOf(node: Node): Record<string, string>
Set an attribute on a node.
setAttribute(node: Node, key: string, value: string): Node
Get an attribute value from a node.
getAttribute(node: Node, key: string): string | undefined
Remove an attribute from a node.
removeAttribute(node: Node, key: string): void
Convert an object of attributes into an array of attribute objects.
toAttrs(attributes: Record<string, string>): Attribute[]
Create a new element node with the specified tag name.
createNode(tagName: string): Element
Create a new text node with the specified text content.
createTextNode(text: string): TextNode
Add a child to a node, making it the first child.
prepend(parent: ParentNode, node: ChildNode): ChildNode
Add a child to a node, making it the last child.
append(parent: ParentNode, node: ChildNode): ChildNode
Replace a node with another node.
replace(originalNode: ChildNode, newNode: ChildNode): ChildNode | undefined
Remove a node from its parent.
remove(node: ChildNode): ChildNode
Get all the nodes in a tree as a flat array.
flatten(node: Node | Node[]): Node[]
Get the text content of a node. Throws an error if the node has multiple children or non-text children.
textOf(node: ParentNode): string
Set the text content of a node.
setText(node: ParentNode, text: string): ParentNode
Check if a string is likely a complete HTML document.
isDocument(string: string): boolean
MIT License
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
Copyright (c) 2025 Cezar Augusto boss@cezaraugusto.net
FAQs
Low-level parse5 node manipulation utilities. ESM-compatible version of parse5-utils.
The npm package parse5-utilities receives a total of 1,468 weekly downloads. As such, parse5-utilities popularity was classified as popular.
We found that parse5-utilities 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.