Problem/Motivation

Drupal 11.4 ships jQuery 4, which removed jQuery.trim(). js/google_analytics.admin.js still calls it twice, both times to read the text of a checkbox label, so the module's settings form throws a TypeError on Drupal 11.4.

The 4.x branch still calls it.

Steps to reproduce

  1. Install Google Analytics 4.0.3 on Drupal 11.4.
  2. Visit /admin/config/services/google-analytics.
  3. Open the browser console.

Proposed resolution

Use the element's own trim. .text() always returns a string, so the null guard jQuery.trim() provided is not needed here.

-  vals.push($.trim($(this).next('label').text()));
+  vals.push($(this).next('label').text().trim());

Confirmed on Drupal 11.4.5 with jQuery 4.0.0.

Remaining tasks

Review the patch.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

kruser created an issue.