[Koha-bugs] [Bug 29295] Page specific jQuery

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Dec 20 17:20:17 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29295

--- Comment #2 from Christopher Brannon <cbrannon at cdalibrary.org> ---
(In reply to Fridolin Somers from comment #1)
> You mean JQuery code added in IntranetUserJS or OPACUserJS ?
> 
> Each page as an id in the body.
> For example :
> <body id="main_intranet-main" class="intranet-main">
> 
> So you can create a code loaded just for that page with :
>   if ( $("body#main_intranet-main").length > 0 ) {

That solution is a logical selector.  I am talking about jquery that will only
be loaded for specific pages.  If you look at ANY page source in Koha, you will
always see ALL of your jQuery, not just jQuery that relates to that page.

Some libraries have a lot of jQuery, and an enhancement of this nature would A)
reduce the amount of code that is looked at and processed when the page is
loaded, and B) reduce unexpected side effects of jQuery that might affect
unintended pages due to mistakes in the Koha or jQuery code.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list