Repository navigation
v4.1.0
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 thegetElements*helpers no longer take quadratic time on deeply nested documents (GHSA-qx47-vpjg-465w, #2406).findOne(),existsOne(), andgetElementById()no longer overflow the stack (RangeError) on deeply nested documents (GHSA-5pwf-qwq7-cwxj, #2406).getText(),textContent(), andinnerText()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(), andfindAll()now preserve TypeScript type-guard narrowing (#2379 by @iamabhisheknag).- Faster
uniqueSort()on large selections andremoveSubsets()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(), andreplaceElement()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()andfilter()now return an empty array without running the predicate whenlimitis0or less (#2369 by @awais-ur-rehman).existsOne()now visits nodes appended by the predicate and throws aTypeErrorif it reaches an empty array slot, matchingfindOne()(#2406).getAttributeValue()and legacy attribute queries now check only own properties, ignoring inheritedObject.prototypeproperties (#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 therel="alternate"(or default)<link>for Atom feeds and entries, falling back to the first<link>(#2380 by @jayhemnani9910).getFeed()now reads Atom entrypubDatefrom<published>, falling back to<updated>when absent or empty (#2395 by @Aschenbath).getFeed()now preserves fractional values for Media RSSbitrate,framerate,samplingrate, andduration(#2382 by @Aschenbath).getFeed()no longer keeps the untrimmed text of trimmed fields in memory (#2404).
Full Changelog: v4.0.2...v4.1.0