Remove jQuery dependency

Created on 10 May 2021, over 3 years ago
Updated 13 August 2024, 3 months ago

Problem/Motivation

Nowadays some frontends avoud jquery at all, so it would be great to remove the dependency of jquery.
https://git.drupalcode.org/project/google_tag/-/blob/8.x-1.x/google_tag....

Proposed resolution

Maybe give an option if it should depend on jquery or be included via vanilla js.

At least we could have a discussion about that topic.
thank you!

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria Grienauer Vienna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States solotandem

    This request seems quite problematic given the only JS file in the project relies on core drupalSetSummary function which, even in branch 10.3.x, relies on jQuery.

  • πŸ‡ΊπŸ‡ΈUnited States kmonty San Francisco, CA

    I think it makes sense to remove the dependency. Core can require it, but the module itself doesn't need to. Eventually the goal is to remove the jQuery dependency from core (as I understand it), so it seems reasonable to get ahead of that.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    What's the state in 2.x? That's where development should happen. Is jQuery already removed there? Then this might be closed outdated and people could switch to 2.x!

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
  • πŸ‡ΊπŸ‡ΈUnited States kmonty San Francisco, CA

    Great call, @anybody! I just looked at the 2.x branch and jQuery isn't used / required as a library. I'll leave it up to the maintainers to close this as outdated, but it strikes me as something that could be.

  • First commit to issue fork.
  • πŸ‡¨πŸ‡¦Canada joelseguin Ontario, Canada

    I've tested with a fresh D10 install and the 2.x branch and it is definitely loading the jQuery library (from /core/assets/vendor/jquery/jquery.min.js).

    To reproduce:

    • Disable CSS and JS aggregation from the Drupal UI
    • Add an actual Google Analytics (G-xxxxxxxx) tag ID
    • You will notice the jquery.min.js file being loaded in the front-end of the site

    I would be happy to test a patch if someone has a chance to work on one.

Production build 0.71.5 2024