Skip to content

Commit 80c7c30

Browse files
authored
Merge pull request #682 from ProgressPlanner/filip/v19/early-exit-no-popover
Fix JS errors when popover for updating / deleting terms is not in the DOM
2 parents b9dddad + 157ff77 commit 80c7c30

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

assets/js/recommendations/remove-terms-without-posts.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
*/
1515
constructor() {
1616
this.popoverId = 'prpl-popover-remove-terms-without-posts';
17+
18+
// Early return if the popover is not found.
19+
if ( ! document.getElementById( this.popoverId ) ) {
20+
return;
21+
}
22+
1723
this.currentTermData = null;
1824
this.currentTaskElement = null;
1925
this.elements = this.getElements();

assets/js/recommendations/update-term-description.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
*/
1515
constructor() {
1616
this.popoverId = 'prpl-popover-update-term-description';
17+
18+
// Early return if the popover is not found.
19+
if ( ! document.getElementById( this.popoverId ) ) {
20+
return;
21+
}
22+
1723
this.currentTermData = null;
1824
this.currentTaskElement = null;
1925
this.elements = this.getElements();

0 commit comments

Comments
 (0)