Koha/authorities
Julian Maurice f000278b32
Bug 30975: Use event delegation for framework plugins
This is to avoid using private jQuery method _data.
Here's what jQuery 1.8.0 release notes says about it:
"this is not a supported public interface; the actual data structures
may change incompatibly from version to version."
So we should not rely on it.

What this patch does is use event delegation [1].
Events are bound to a parent container, so when elements are added
dynamically inside that container, we don't need to re-attach event
handlers manually

This patch also comes with a bit of cleanup, and introduce "breaking
changes" (they are breaking changes only if you happen to have custom
framework plugins):
1) 'mouseover', 'mousemove', 'keypress' events are no longer listened to
   'mouseover' and 'mousemove' are not used and would trigger too much
   events.
   'keypress' is also not used, and is deprecated
2) Event handlers now takes a single parameter that is an Event object
   It just makes the code a lot less complicated.
3) Event handlers do not pollute the global scope anymore

[1] https://learn.jquery.com/events/event-delegation/

Test plan:
- Go to every page that has a MARC editor and verify that plugins still
  work. This includes addbiblio.pl, additem.pl, authorities.pl,
  neworderempty.pl, orderreceive.pl
- Test plugins that use 'focus' event (for instance barcode.pl), 'blur'
  event (callnumber.pl) and 'click' event (almost all the others)
- Test that plugins work on cloned fields/subfields

Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-27 17:32:33 +01:00
..
auth_finder.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
authorities-home.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
authorities.pl Bug 30975: Use event delegation for framework plugins 2025-02-27 17:32:33 +01:00
blinddetail-biblio-search.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
detail-biblio-search.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
detail.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
export.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
merge.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
merge_ajax.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ysearch.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00