Skip to content

v4.1.0

Choose a tag to compare

@fb55 fb55 released this 03 Dec 11:53
· 2 commits to master since this release

Security

  • getFeed() treats an <item> or <entry> nested in another item as part of the outer item, so nested items no longer multiply media objects (GHSA-67qx-9g9r-35qr, #2409).
  • removeSubsets() no longer takes quadratic time on many nodes from deep or wide documents (GHSA-42h4-gpjh-8xhf, #2313 by @zhangj23).
  • find(), findAll(), filter(), and the getElements* helpers no longer take quadratic time on deeply nested documents (GHSA-qx47-vpjg-465w, #2406).
  • findOne(), existsOne(), and getElementById() no longer overflow the stack (RangeError) on deeply nested documents (GHSA-5pwf-qwq7-cwxj, #2406).
  • getText(), textContent(), and innerText() no longer overflow the stack (RangeError) on deeply nested documents (GHSA-f3vc-4w2g-4762, #2408).
  • compareDocumentPosition() no longer takes quadratic time on deeply nested documents (GHSA-pvqx-4ghw-x6gp, #2407).

Improvements

  • filter(), find(), findOne(), and findAll() now preserve TypeScript type-guard narrowing (#2379 by @iamabhisheknag).
  • Faster uniqueSort() on large selections and removeSubsets() on single nodes (#2313 by @zhangj23, #2405, #2407).
  • getSiblings() is now linear in the number of siblings for parentless nodes (#2406).

Fixes

  • In trees with parent links, appendChild(), prependChild(), append(), prepend(), and replaceElement() now ignore insertions that would create a cycle (#2375 by @jeromeyyy).
  • replaceElement() now detaches the replacement node from its old position, makes self-replacement a no-op, and clears the replaced node's sibling links (#2358 by @feritcemkahraman).
  • compareDocumentPosition() now orders leaf nodes (such as text or comments) correctly relative to sibling elements (#2329 by @spokodev).
  • find() and filter() now return an empty array without running the predicate when limit is 0 or less (#2369 by @awais-ur-rehman).
  • existsOne() now visits nodes appended by the predicate and throws a TypeError if it reaches an empty array slot, matching findOne() (#2406).
  • getAttributeValue() and legacy attribute queries now check only own properties, ignoring inherited Object.prototype properties (#2394 by @Aschenbath).
  • innerText() now extracts text from top-level document nodes while still skipping nested documents such as <template> content (#2389 by @Aschenbath).
  • getFeed() now prefers the rel="alternate" (or default) <link> for Atom feeds and entries, falling back to the first <link> (#2380 by @jayhemnani9910).
  • getFeed() now reads Atom entry pubDate from <published>, falling back to <updated> when absent or empty (#2395 by @Aschenbath).
  • getFeed() now preserves fractional values for Media RSS bitrate, framerate, samplingrate, and duration (#2382 by @Aschenbath).
  • getFeed() no longer keeps the untrimmed text of trimmed fields in memory (#2404).

Full Changelog: v4.0.2...v4.1.0