From 1b888e5e9693bc28945c37628cdfd37766e87a98 Mon Sep 17 00:00:00 2001 From: Igor Fedoronchuk Date: Thu, 1 Oct 2026 12:47:01 +0200 Subject: [PATCH] Scope the .ready() comment to the jQuery this gem runs on The comment that shipped with the binding fix said jQuery 4 keeps the same .ready() implementation. That is true, but it is also beside the point: the gemspec pins activeadmin ~> 3.2, and Active Admin 3 requires jquery3 outright in its base.js, so this code only ever runs on jQuery 3. Reasoning about a version the gem cannot be installed alongside is noise in a file that ships to every consumer. State the jQuery 3 behaviour, which is the whole justification, and drop the rest. --- .../javascripts/active_admin_date_range_preset.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/vendor/assets/javascripts/active_admin_date_range_preset.js b/vendor/assets/javascripts/active_admin_date_range_preset.js index 4ed2d9a..44b565f 100644 --- a/vendor/assets/javascripts/active_admin_date_range_preset.js +++ b/vendor/assets/javascripts/active_admin_date_range_preset.js @@ -103,12 +103,11 @@ $(function () { return additional_items_html += '
' + el['title'] + '
'; }); - // Bind in the same tick the popup is appended. jQuery 3 reimplemented - // .ready() on top of a Deferred, whose .then schedules through - // setTimeout, so handlers attached inside it landed a macrotask late - // and the popup was on screen but inert until then. jQuery 4 keeps - // that implementation, so waiting buys nothing there either, and - // .ready() on a non-document collection has been deprecated since 3.0. + // Bind in the same tick the popup is appended. Active Admin 3 ships + // jQuery 3, which rebuilt .ready() on top of a Deferred whose .then + // schedules through setTimeout, so handlers attached inside it landed + // a macrotask late and the popup was on screen but inert until then. + // On a non-document collection the method is deprecated anyway. let container = $('
' + '
Today
' + '
Yesterday
' +