From 1809cf7061b139c724a551e08d67e8eefb2a3cfe Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 20 Sep 2022 11:27:20 +0200 Subject: [PATCH] [22.05] Bug 30975: Fix framework plugins on cloned fields/subfields This patch uses the internal method jQuery._data to retrieve and clone all events attached to a cloned field/subfield. It's intended for stable releases only, so they can stay compatible with existing plugins --- koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js index 16cf857..44f1bbf 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js @@ -431,9 +431,8 @@ function AddEventHandlers (oldcontrol, newcontrol, newinputid ) { // This function is a helper for CloneField and CloneSubfield. // It adds the event handlers from oldcontrol to newcontrol. // newinputid is the id attribute of the cloned controlling input field -// Note: This code depends on the jQuery data for events; this structure -// is moved to _data as of jQuery 1.8. - var ev= $(oldcontrol).data('events'); +// Note: This code depends on the jQuery internal method _data which is not recommended + var ev = jQuery._data(oldcontrol, 'events') if(typeof ev != 'undefined') { $.each(ev, function(prop,val) { $.each(val, function(prop2,val2) { -- 2.30.2