Skip to content

Commit da7d244

Browse files
fix: do not remove Edit on GitHub if it does not exist (#4739)
Do not attempt to remove #editOnGitHubLink's .parentNode if it doesn't exist on the page. For example, this element does not exist on 404 page: https://nodejs.org/amNotExist
1 parent 145144e commit da7d244

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

static/js/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@
166166
var editOnGitHubElement = document.getElementById('editOnGitHubLink');
167167
var editOnGitHubUrlElement = document.getElementById('editOnGitHubUrl');
168168

169+
if (!editOnGitHubElement) {
170+
return;
171+
}
172+
169173
if (editOnGitHubUrlElement) {
170174
editOnGitHubElement.setAttribute('href', editOnGitHubUrlElement.value);
171175
} else {

0 commit comments

Comments
 (0)