Skip to content

Commit

Permalink
Repalced all use of evt.path[0] with evt.composedPath(), which is the…
Browse files Browse the repository at this point in the history
… standard way fo doing it. Makes Firefox and Safari both appear to work entirely. Part of #25.
  • Loading branch information
jkomoros committed Dec 26, 2018
1 parent fc6508c commit 01948ee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/base-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class BaseCard extends LitElement {
_handleClick(e) {
//We only cancel link following if editing is true
if (!this.editing) return;
let ele = e.path[0];
let ele = e.composedPath()[0];
if (ele.localName != 'a') return;
//Links that will open a new tab are fine
if (ele.target == "_blank") return;
Expand Down
8 changes: 4 additions & 4 deletions src/components/card-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ class CardDrawer extends connect(store)(LitElement) {
}

_handleDragEnter(e) {
let ele = e.path[0];
let ele = e.composedPath()[0];
ele.classList.add('drag-active')
}

_handleDragLeave(e) {
let ele = e.path[0];
let ele = e.composedPath()[0];
ele.classList.remove('drag-active');
}

Expand Down Expand Up @@ -151,7 +151,7 @@ class CardDrawer extends connect(store)(LitElement) {
}

_handleDrop(e) {
let target = e.path[0];
let target = e.composedPath()[0];
target.classList.remove('drag-active');
let thumbnail = this._dragging;
let index = target.index;
Expand All @@ -163,7 +163,7 @@ class CardDrawer extends connect(store)(LitElement) {
}

_handleChange(e) {
let ele = e.path[0];
let ele = e.composedPath()[0];
store.dispatch(showSection(ele.value));
}

Expand Down
12 changes: 6 additions & 6 deletions src/components/card-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,41 +159,41 @@ class CardEditor extends connect(store)(LitElement) {

_handleTitleUpdated(e) {
if (!this._active) return;
let ele = e.path[0];
let ele = e.composedPath()[0];
store.dispatch(titleUpdated(ele.value));
}

_handleBodyUpdated(e) {
if (!this._active) return;
let ele = e.path[0];
let ele = e.composedPath()[0];
store.dispatch(bodyUpdated(ele.value));
}

_handleSectionUpdated(e) {
if (!this._active) return;
let ele = e.path[0];
let ele = e.composedPath()[0];
store.dispatch(sectionUpdated(ele.value));
}

_handleNameUpdated(e) {
if (!this._active) return;
let ele = e.path[0];
let ele = e.composedPath()[0];
store.dispatch(nameUpdated(ele.value));
}

_handleAddSlug(e) {
if (!this._active) return;
if (!this._card) return;
let id = this._card.id;
let ele = e.path[0];
let ele = e.composedPath()[0];
let value = prompt("Slug to add:");
if (!value) return;
store.dispatch(addSlug(id, value));
}

_handleSubstantiveChanged(e) {
if (!this._active) return;
let ele = e.path[0];
let ele = e.composedPath()[0];
store.dispatch(substantiveUpdated(ele.checked));
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/maintenance-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MaintenanceView extends connect(store)(PageViewElement) {
}

_handleClick(e) {
let ele = e.path[0];
let ele = e.composedPath()[0];
let value = ele.value;
let func = tasks[value];
if (!func) {
Expand Down

0 comments on commit 01948ee

Please sign in to comment.