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
This commit is contained in:
@@ -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});
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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});
|
||||
|
Reference in New Issue
Block a user