Skip to content

v5.2.0

Latest

Choose a tag to compare

@rgrove rgrove released this 12 Nov 01:30
· 1 commit to main since this release
v5.2.0
811867f

Added

  • Added a new maxElementDepth parser option, which limits how deeply elements may be nested. A document that exceeds the limit is rejected with an XmlError. The default limit is 256, so documents with elements nested more deeply than that will now be rejected unless you raise the limit. Previously, a deeply nested document could cause the parser, or recursive traversal of the resulting node tree, to throw a RangeError by exhausting the call stack. #54

Fixed

  • An XML declaration with no whitespace between the encoding declaration and the standalone declaration (e.g. <?xml version="1.0" encoding="UTF-8"standalone="yes"?>) is now rejected, as required by the XML spec. #53

  • An XML declaration with an empty or incomplete encoding or standalone declaration (e.g. encoding="", encoding=, or standalone without a value) is now rejected. Previously, the invalid declaration was silently ignored.

  • A doctype declaration with no whitespace before its system identifier (e.g. <!DOCTYPE a SYSTEM"a.dtd"> or <!DOCTYPE a PUBLIC "a""a.dtd">) is now rejected, as required by the XML spec.

  • Parsing a text node, CDATA section, comment, or processing instruction that contains many carriage returns is no longer extremely slow. Line break normalization previously took time proportional to the square of the number of carriage returns, so a document containing a few hundred kilobytes of carriage returns could take many seconds to parse.

  • XmlNode#document and XmlNode#isRootNode no longer recurse up the node tree, so they can no longer exhaust the call stack in a deeply nested tree. isRootNode is also faster, which speeds up toJSON().

Full Changelog: v5.1.0...v5.2.0