Unnecessary frontend JavaScript / jQuery dependency
-
Hi,
I noticed that the plugin enqueuesapd-public.jswithjqueryas a dependency:wp_enqueue_script( 'apd-public', APD_PLUGIN_URL . 'public/js/apd-public.js', array( 'jquery' ), APD_VERSION, true );This seems unnecessary because the functionality implemented in
apd-public.jsis already implemented in the plugin’s CSS.The CSS already handles the checked state:
.apd-deposit-option input:checked + .apd-option-content .apd-option-radio { border-color: #6366f1; }So the plugin is currently loading an additional JavaScript file, jQuery, and consequently jQuery Migrate, just to implement functionality that is already covered by CSS.
This is especially problematic for modern WordPress sites using FSE/block themes, where jQuery is generally not used on the frontend. Adding jQuery solely for this small visual interaction unnecessarily increases the frontend dependencies.
Is there a reason for keeping
apd-public.jsand the jQuery dependency here? From what I can see, this JavaScript can be removed without losing any functionality.Thanks for looking into this!
You must be logged in to reply to this topic.