Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(nuxt): swallow issues with query selectors
Browse files Browse the repository at this point in the history
resolves #8732
  • Loading branch information
danielroe committed Nov 9, 2022
1 parent 1582f8e commit e5be451
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/nuxt/src/pages/runtime/router.options.ts
Expand Up @@ -48,10 +48,12 @@ export default <RouterConfig> {
}

function _getHashElementScrollMarginTop (selector: string): number {
const elem = document.querySelector(selector)
if (elem) {
return parseFloat(getComputedStyle(elem).scrollMarginTop)
}
try {
const elem = document.querySelector(selector)
if (elem) {
return parseFloat(getComputedStyle(elem).scrollMarginTop)
}
} catch {}
return 0
}

Expand Down

0 comments on commit e5be451

Please sign in to comment.