Update e.currentTarget to Polymer.dom(e).localTarget
This does essentially the same thing, but uses event retargetting to
simulate event.target under shadow DOM. This acts the same as
currentTarget because the node is always in the same scope as the node
where the listener was added. This is polyfilled to work in older
browsers than e.currentTarget and is less likely to have issues with
shadow DOM.
https://www.polymer-project.org/1.0/docs/devguide/events#retargeting
Change-Id: I6fe5afdfddfdc3e21fbca10aef260cac704bea3d
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
index 8f2468b..2cda515 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
@@ -666,7 +666,7 @@
_handleActionTap(e) {
e.preventDefault();
- const el = e.currentTarget;
+ const el = Polymer.dom(e).localTarget;
const key = el.getAttribute('data-action-key');
if (key.startsWith(ADDITIONAL_ACTION_KEY_PREFIX)) {
this.fire(`${key}-tap`, {node: el});
diff --git a/polygerrit-ui/app/elements/settings/gr-email-editor/gr-email-editor.js b/polygerrit-ui/app/elements/settings/gr-email-editor/gr-email-editor.js
index 708a799..2d3f1c3 100644
--- a/polygerrit-ui/app/elements/settings/gr-email-editor/gr-email-editor.js
+++ b/polygerrit-ui/app/elements/settings/gr-email-editor/gr-email-editor.js
@@ -62,7 +62,8 @@
},
_handleDeleteButton(e) {
- const index = parseInt(e.currentTarget.getAttribute('data-index'), 10);
+ const index = parseInt(Polymer.dom(e).localTarget
+ .getAttribute('data-index'), 10);
const email = this._emails[index];
this.push('_emailsToRemove', email);
this.splice('_emails', index, 1);
diff --git a/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor.js b/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor.js
index 328d3d9..fb868e8 100644
--- a/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor.js
+++ b/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor.js
@@ -58,7 +58,7 @@
},
_showKey(e) {
- const el = e.currentTarget;
+ const el = Polymer.dom(e).localTarget;
const index = parseInt(el.getAttribute('data-index'), 10);
this._keyToView = this._keys[index];
this.$.viewKeyOverlay.open();
@@ -69,7 +69,7 @@
},
_handleDeleteKey(e) {
- const el = e.currentTarget;
+ const el = Polymer.dom(e).localTarget;
const index = parseInt(el.getAttribute('data-index'), 10);
this.push('_keysToRemove', this._keys[index]);
this.splice('_keys', index, 1);
diff --git a/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands.js b/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands.js
index ea2492a..f2f218b 100644
--- a/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands.js
+++ b/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands.js
@@ -64,7 +64,7 @@
_handleSchemeTap(e) {
e.preventDefault();
- const el = e.currentTarget;
+ const el = Polymer.dom(e).localTarget;
this.selectedScheme = el.getAttribute('data-scheme');
if (this._loggedIn) {
this.$.restAPI.savePreferences({download_scheme: this.selectedScheme});