npm / @xmldom/xmldom
@xmldom/xmldom
What changed in @xmldom/xmldom 0.8 to 0.9, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
5 breaking18 security1 deprecations1 new APIs and options5 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@xmldom/xmldom 0.928 changes
Breaking changes 5
Name creation rejects names containing a line terminator with InvalidCharacterError; the same validation change applies to createAttributeNS, createDocumentType, and createAttribute.
Creation now rejects invalid XML Names; requireWellFormed serialization also validates EntityReference nodeName and throws InvalidStateError for invalid names.
Malformed tag-name scanning now terminates at an embedded
<, avoiding quadratic recovery behavior; DOM output is unchanged, but reported error text can differ.With requireWellFormed enabled, serialization validates processing-instruction targets as XML NCNames and rejects case-insensitive
xml, throwing InvalidStateError.With requireWellFormed enabled, serialization now rejects invalid element and attribute names that are not valid XML QNames, preventing XML injection.
Security 17
Parsing duplicate attributes is now O(M) rather than O(M²), preventing hostile numbers of duplicate attributes from wedging the parse while preserving attribute order and duplicate resolution.
Parsing deeply or repeatedly namespaced documents now uses linear rather than quadratic memory, preventing a denial-of-service with default options.
An end tag with a valid name followed by trailing content now reports a recoverable error instead of being silently accepted; parsing recovers to the same DOM, and errorHandler can escalate it to fatal.
End tags with a valid name followed by trailing content now report a recoverable XML error or HTML warning instead of being silently accepted; parsing still recovers to the same DOM.
Closing tags are matched case-insensitively and missing closing tags are handled explicitly, preventing output amplification and denial-of-service.
Malformed tag-name scanning and Node.prototype.normalize() now run in linear time rather than quadratic time; DOM output is unchanged, though reported error text may differ.
Deeply or repeatedly namespaced documents now use O(N) rather than O(N²) memory during parsing, preventing a denial-of-service through DOMParser.parseFromString with default options.
Adjacent text nodes are now merged in linear rather than quadratic time, including when normalize is called programmatically.
With requireWellFormed enabled, serialization rejects a DocType name that is not a valid XML Name by throwing InvalidStateError.
Element- and attribute-name validation now rejects names containing an interior line terminator, closing a QName-check bypass.
DocType publicId and systemId validation now rejects identifiers containing an ECMAScript line terminator.
With requireWellFormed enabled, serialization validates EntityReference nodeName as an XML Name and throws InvalidStateError for invalid names.
The processing-instruction grammar regex no longer backtracks quadratically on unterminated processing instructions, preventing a denial-of-service with default parser options.
DOM traversal operations are iterative, so deeply nested DOM trees no longer exhaust the JavaScript call stack and throw an unrecoverable RangeError.
Serializer methods accept requireWellFormed; when true, serialization throws InvalidStateError for injection-prone node content, helping prevent XML injection.
Passing data containing "]]>" now throws InvalidCharacterError, as required by the WHATWG DOM spec.
CDATASection nodes containing "]]>" are split into adjacent CDATA sections during serialization, preventing XML injection via mutation methods.
Deprecations 1
The serializer option is deprecated and will be removed in the next breaking release; use requireWellFormed: true or ensure CDATASection data does not contain ]]> before serialization.
New APIs and options 1
Adds the ParentNode.children getter.
Fixes and other changes 4
DOMExceptions raised during parsing are reported as fatalError, and the originating error is preserved as the resulting ParseError's cause.
CharacterData nodeValue and data are now kept in sync.
isEqualNode now returns false when comparing CDATASection nodes with different data.
Correctly traverses the ancestor chain.
@xmldom/xmldom 0.82 changes
Security 1
xmldom: End-tag Whitespace-Trim Regex ReDoS — quadratic backtracking in the 0.8.x end-tag parser
Fixes and other changes 1
Trailing whitespace in ProcessingInstruction data is now preserved.