From 9f1a88e0ccc926a26a61790f3b75c39b9d00a50b Mon Sep 17 00:00:00 2001 From: tkalliom Date: Mon, 4 Apr 2022 15:04:45 +0300 Subject: [PATCH] Don't call deprecated jQuery method "bind" --- .../active_admin/active_admin_globalize.js.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/active_admin/active_admin_globalize.js.coffee b/app/assets/javascripts/active_admin/active_admin_globalize.js.coffee index a4cc79ee..46c08777 100644 --- a/app/assets/javascripts/active_admin/active_admin_globalize.js.coffee +++ b/app/assets/javascripts/active_admin/active_admin_globalize.js.coffee @@ -135,8 +135,12 @@ $ -> updateLocaleButtonsStatus($dom) $tabs.filter('.default').click() + $a = $("a") + # jQuery 1.7 introduced "on" and deprecated "bind" + # AA 1.2 bumps jquery-rails to >= 4.2, so we can drop "bind" once AA req is bumped + bindingMethod = if ("on" of $a && typeof $a.on == 'function') then "on" else "bind" # this is to handle elements created with has_many - $("a").bind "click", -> + $a[bindingMethod] "click", -> setTimeout( -> translations() 50