dom-serializer renders domhandler DOM nodes (or an array of them) to an HTML or XML string, similar to an outerHTML-style output. It is useful when you need to turn a parsed or programmatically built DOM back into serialized markup, with options to control entity encoding, attribute formatting, and self-closing tag behavior.
Project status
- Actively maintained: The upstream push is today (2026-06-11), and there have been multiple recent updates in 2026 (v3.0.0 on 2026-03-17, v3.1.0 and v3.1.1 on 2026-05-02), indicating ongoing work rather than a dormant state.
- Update cadence: Roughly every 6 to 8 weeks in 2026 so far (March to early/mid May), with an additional activity signal from the upstream push on 2026-06-11.
AI summary generated
Recent updates
v3.1.1
v3.1.1 makes a small compatibility-focused change to attribute serialization. It updates the attribute iteration logic to avoid including inherited properties when formatting attributes.
v3.1.0
v3.1.0 focuses on faster DOM serialization, with an intended ~40% improvement. The release notes also mention documentation updates around the security caveat for `encodeEntities: false`, including a threat model style outline.
v3.0.0
v3.0.0 changes dom-serializer to be ESM only, and adds support for non-string attribute values by coercing them to strings before escaping. The codebase also reflects a broader modernization (tooling, build output, and major dependency upgrades) beyond what is stated in the release notes.
BreakingFeaturesv2.0.0
The provided code diff for v2.0.0 shows only version number updates in package.json and package-lock.json. No functional code changes, dependency updates, or build/output changes are present in the diff that would correspond to the release notes features and dependency bumps.
Featuresv1.4.1
v1.4.1 is a re-release of version 1.3.2. The release notes do not describe any functional, API, security, or performance changes, and direct users to the v1.4.0 release notes for the underlying explanation.
v1.4.0
v1.4.0 introduces a refactor of how DOM nodes are serialized, particularly around entity encoding, adding support for an `encodeEntities` option. The release notes are essentially only a warning about depending on `domhandler@5` types, while the code diff shows additional API surface and packaging changes. Significant behavior changes are present in attribute and text escaping logic, plus Node/packaging changes (ESM exports) that can break consumers.
BreakingFeaturesv1.3.2
v1.3.2 refactors dom-serializer to accept broader array-like inputs for the node(s) being serialized, and updates documentation/examples (notably aligning examples with selfClosingTags and adding domhandler references). The main functional change is in how the input is detected and iterated when it is a collection-like value.
Featuresv1.3.1
Release v1.3.1 is primarily a documentation update. It adds richer API documentation for `render` and `DomSerializerOptions`, including details and examples for options like `emptyAttrs`, `selfClosingTags`, and `xmlMode`, plus updates to the README and version metadata.
v1.3.0
v1.3.0 updates dom-serializer behavior around entity decoding/encoding, and adds test coverage for how entities are handled in special tags under different modes. It also upgrades dependencies used by the project.
Breakingv1.2.0
v1.2.0 updates dom-serializer to use an exhaustive switch over the ElementType enum, and adjusts CI to run tests on ppc64le. It also bumps several runtime dependencies (domhandler, domelementtype, entities).