diff --git a/src/platforms/GitHub/index.ts b/src/platforms/GitHub/index.ts index e6c9e00..136ee8c 100644 --- a/src/platforms/GitHub/index.ts +++ b/src/platforms/GitHub/index.ts @@ -106,6 +106,11 @@ function resolvePageScope(defaultBranchName?: string) { const pathSHAMap = new Map() +// Try lookup PJAX containers, #js-repo-pjax-container could exist while #repo-content-pjax-container does not. +const pjaxContainerSelector = ['#repo-content-pjax-container', '#js-repo-pjax-container'].find( + selector => document.querySelector(selector), +) + export const GitHub: Platform = { isEnterprise, resolvePartialMetaData() { @@ -201,7 +206,7 @@ export const GitHub: Platform = { delegatePJAXProps(options) { if (!options?.node || options.node.type === 'blob') return { - 'data-pjax': '#repo-content-pjax-container, #js-repo-pjax-container', + 'data-pjax': pjaxContainerSelector, onClick() { /* Overwriting default onClick */ },