Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
See https://www.drupal.org/node/2462717, which is the CR for #1279226: jQuery and Drupal JavaScript libraries and settings are output even when no JS is added to the page.
That recent D7 API addition makes it possible for those Drupal modules whose JS does not rely on jQuery, to not load jQuery.
Google Analytics — when used in its simplest form — is a great example of that.
Proposed resolution
Make a one-line modification to the Google Analytics module so that it informs Drupal 7 that it doesn't depend on jQuery.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#8 | Issue-2509446-by-wim-hass-Specify-requiresjquery--FA.patch | 1.55 KB | hass |
Comments
Comment #1
Wim LeersComment #2
Wim LeersComment #3
hass CreditAttribution: hass commentedI'm confused what these basic mode should be.
The module code requires jquery... See the js file in the module. There are several event handlers attached and some jquery features used.
Comment #4
Wim LeersOnly the module's JS files require jQuery. And the way those are added:
that still causes jQuery to be attached.
The majority of things just call the
ga()
function, which doesn't require jQuery.i.e. this patch just says that the built tracker code does not require jQuery.
Comment #5
hass CreditAttribution: hass commentedComment #6
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedWell, this makes a lot of sense, and the patch looks simple enough. Not RTBC'ing because i haven't manually tested the patch, but it looks good to me!
Comment #7
Wim Leers#5: d'oh, all of those metadata changes make sense — apologies, and thank you!
Comment #8
hass CreditAttribution: hass commentedThe patch looks incomplete. New patch attached.
The deal to get this in is - fix #2391025: Add support for inline JS/CSS with #attached and I commit this patch here.
Comment #10
hass CreditAttribution: hass commented