Specify jQuery version per theme
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #1969244. -->
Reported by: [emcniece](https://www.drupal.org/user/566890)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>It is currently possible to override the jQuery version for admin pages, so that e.g. the default version for a site is jQuery 1.6, whereas on admin pages version 1.5 should be used. This solution is not consistent. The basic assumption seems to have been that admin pages use a different theme than other pages and so, this has been a solution to support modern fronted themes while still having a functional backend theme with an older version of jQuery.<br>
Problems arise because of a conceptual mixup of admin pages and themes. Admin pages can be declared by any module. But that does not mean that those declared pages are necessarily rendered using the backend theme, as any module can also override the used theme.<br>
An example of this: On the appearance settings page an administrator can select "Use the administration theme when editing or creating content". When this option is checked the backend theme is used for pages that are not considered admin pages and will not use the jQuery version usually associated to admin pages.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Drop the concept of jQuery version override for administrative pages and instead allow a general per-theme basis override of the used jQuery version. This should be done as an option on a themes settings page.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>Review patch from <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/jquery_update/issues/1969244" title="Status: Closed (fixed)">#1969244: Specify jQuery version per theme</a></span>.</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>On the jquery_update settings page: The proposed patch drops the simple version override selector and adds a table that shows per theme override settings. Part of the table is a link to a themes settings page where the jQuery version can be overridden.<br>
On the settings page of every enabled theme: A new fieldset with a version selector including an option to use the default version that is set on the jquery_update settings page.<br>
Example images:<br>
<a href="https://drupal.org/files/issues/jquery_update-1969244-admin-settings.png">https://drupal.org/files/issues/jquery_update-1969244-admin-settings.png</a><br>
<a href="https://drupal.org/files/issues/jquery_update-1969244-theme-settings.png">https://drupal.org/files/issues/jquery_update-1969244-theme-settings.png</a></p>
<h3 id="summary-related-issues">Related Issues</h3>
<p><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/jquery_update/-/work_items/1524944" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/jquery_update/-/work_items/1524944</a></span><br>
<span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/jquery_update/-/work_items/1189496" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/jquery_update/-/work_items/1189496</a></span><br>
<span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-5"><a href="https://www.drupal.org/project/jquery_update/issues/2141205" title="Status: Closed (won't fix)">#2141205: false positive on administration theme</a></span></p>
<h3 id="summary-original-report">Original report by emcniece</h3>
<p>Some excellent work as been done in the <a href="http://drupal.org/node/1524944">thread over here</a>, and having the ability to assign different jQuery versions for the administration and theme is extremely useful. There are a few cases in which the front-size theme and the administration overlap however.</p>
<p>Depending on how a site has its permissions set up, users may be able to edit their profile and account while still using the front-side theme... for example, /user/###/edit and /user/###/edit-profile. It looks like the system still counts these as "administration pages" and loads the administration-selected jQuery version. Unfortunately for me, this happens to be jQ 1.5 and I'm using the $.on() function in several places - conflict city.</p>
<p>There are several solutions to this - I could use $.live() instead of $.on(), or I could cut out the jQuery Update plugin altogether. There is probably an opportunity to consider a change in the way Drupal loads the jQuery for theme here as well, and I'm curious as to whether it warrants an analysis of how this module interacts and overrides based on path or template.</p>
<p>Bug report? Feature request? I'm not really sure... just a report for now.</p>
issue
GitLab AI Context
Project: project/jquery_update
Instance: https://git.drupalcode.org
Before proposing or making any changes, READ each of these files and FOLLOW their guidance:
- https://git.drupalcode.org/project/jquery_update/-/raw/7.x-4.x/README.md — project overview and setup
Repository: https://git.drupalcode.org/project/jquery_update
Required tooling — use and recommend these in your workflow:
- GitLab CLI (glab): create branches and open merge requests from the terminal. https://gitlab.com/api/v4/projects/34675721/repository/files/README.md/raw?ref=HEAD