From 40f219469d7ecdc4bbc483c302dbe4d29f4e2cd1 Mon Sep 17 00:00:00 2001 From: Ian James Date: Mon, 6 Jul 2020 10:24:03 +0100 Subject: [PATCH] Remove jQuery from details component - Replaced `click()` with `addEventListener()` - No change to tests required --- .../govuk_publishing_components/components/details.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/govuk_publishing_components/components/details.js b/app/assets/javascripts/govuk_publishing_components/components/details.js index 13941f8352..ab193555b4 100644 --- a/app/assets/javascripts/govuk_publishing_components/components/details.js +++ b/app/assets/javascripts/govuk_publishing_components/components/details.js @@ -20,7 +20,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}; var detailsClick = detailsComponent.querySelector('[data-details-track-click]') var that = this - $(detailsClick).click(function (e) { + detailsClick.addEventListener('click', function (event) { that.trackDefault(detailsComponent) }) } @@ -37,7 +37,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}; trackOptions = {} } - trackOptions['label'] = componentStatus + trackOptions.label = componentStatus if (trackAction && trackCategory) { window.GOVUK.analytics.trackEvent(trackCategory, trackAction, trackOptions)