From f92b25d5ec331d8f57eea4271c04e11be43af911 Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Thu, 22 Aug 2019 21:55:16 +0000 Subject: [PATCH] Bug 1574949 - Use event.currentTarget to get the reference to the button when acting on the click event so it will work regardless of what inner content is clicked or if the button itself is clicked. r=MattN I didn't switch to using an A element with href= since the link target depends on the value of a preference, which is set at runtime in browser_dismissFooter.js and would necessitate refactoring of the test. Differential Revision: https://phabricator.services.mozilla.com/D43124 --HG-- extra : moz-landing-system : lando --- browser/components/aboutlogins/content/aboutLogins.html | 8 ++++---- .../aboutlogins/content/components/login-footer.js | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/browser/components/aboutlogins/content/aboutLogins.html b/browser/components/aboutlogins/content/aboutLogins.html index afe780663dc5..480908ef4d45 100644 --- a/browser/components/aboutlogins/content/aboutLogins.html +++ b/browser/components/aboutlogins/content/aboutLogins.html @@ -227,11 +227,11 @@

- - diff --git a/browser/components/aboutlogins/content/components/login-footer.js b/browser/components/aboutlogins/content/components/login-footer.js index 4906145193ca..7575393d330f 100644 --- a/browser/components/aboutlogins/content/components/login-footer.js +++ b/browser/components/aboutlogins/content/components/login-footer.js @@ -25,14 +25,15 @@ export default class LoginFooter extends HTMLElement { handleEvent(event) { switch (event.type) { case "click": { - let classList = event.originalTarget.classList; + let target = event.currentTarget; + let classList = target.classList; if ( - classList.contains("image-play-store") || - classList.contains("image-app-store") || + classList.contains("play-store") || + classList.contains("app-store") || classList.contains("close") ) { - let eventName = event.originalTarget.dataset.eventName; + let eventName = target.dataset.eventName; const linkTrackingSource = "Footer_Menu"; document.dispatchEvent( new CustomEvent(eventName, {