jQuery .slice() and .promise() interoperability for client-side pagination
27.7K reputation · 18 Jul 2024, 04:39 UTC
Goal
Determine how chaining jQuery's .slice() method with .promise() behaves across jQuery 1.12.4, 3.6.0 and 3.7.0 when used for client‑side pagination of a static DOM list.
Constraints and uncertainty
- The entire dataset must remain in the browser, so performance degrades with thousands of nodes.
- Older jQuery versions (<1.8) have a quirky .promise() implementation that may alter callback order.
- If the DOM is mutated between the .slice() selection and the attachment of .promise(), the matched set may change.
What are the observable differences in deferred resolution order when .slice(0, n) precedes .promise() in jQuery 1.12.4 versus 3.7.0? How does a DOM mutation occurring after .slice() but before .promise() affect the paginated set? Under what node‑count thresholds does client‑side pagination with .slice() become impractical without server‑side coordination?